node_io 1.0.0-dev.2.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

node_io

This library exposes Node I/O functionality in dart:io way. It wraps Node.js I/O modules (like fs and http) and implements them using abstractions provided by dart:io (like File, Directory or HttpServer).

If you are looking for direct access to Node.js API see node_interop package.

Usage

A basic example of accessing file system:

import 'package:node_io/node_io.dart';

void main() {
  print(Directory.current);
  print("Current directory exists: ${Directory.current.existsSync()}");
  print('Current directory contents: ');
  Directory.current.list().listen(print);
}

Configuration and build

Add build_node_compilers and build_runner to dev_dependencies section in pubspec.yaml of your project:

dev_dependencies:
  build_runner: # needed to run the build
  build_node_compilers:

Add build.yaml file to the root of your project:

targets:
  $default:
    sources:
      - "node/**"
      - "test/**" # Include this if you want to compile tests.
      - "example/**" # Include this if you want to compile examples.

By convention all Dart files which declare main function go in node/ folder.

To build your project run following:

pub run build_runner build --output=build/

Detailed instructions can be found in build_node_compilers package docs.

Features and bugs

Please file feature requests and bugs at the issue tracker.

1.0.0-dev.2.0

  • Complete implementation of InternetAddress.

1.0.0-dev.1.0

  • Split from node_interop.

example/node_io.dart

import 'package:node_io/node_io.dart';

void main() {
  print(Directory.current);
  print("Current directory exists: ${Directory.current.existsSync()}");
  print('Current directory contents: ');
  Directory.current.list().listen(print);
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  node_io: "^1.0.0-dev.2.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:node_io/node_io.dart';
        
Version Uploaded Documentation Archive
1.0.0-dev.2.0 Feb 14, 2018 Go to the documentation of node_io 1.0.0-dev.2.0 Download node_io 1.0.0-dev.2.0 archive
1.0.0-dev.1.0 Feb 13, 2018 Go to the documentation of node_io 1.0.0-dev.1.0 Download node_io 1.0.0-dev.1.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 14, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
98 / 100
Overall score:
Weighted score of the above. [more]
50

Platforms

Detected platforms: web, other

Primary library: package:node_io/node_io.dart with components: js, io.

Suggestions

  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <2.0.0
node_interop ^1.0.0-dev.2.0 1.0.0-dev.2.0
Transitive dependencies
js 0.6.1
Dev dependencies
build_node_compilers ^0.1.0
build_runner ^0.7.9
test ^0.12.24