p-hatan/ mirror

pub repository

mirror.p-hatan.ir

node_io

1.0.0

Like dart:io but with Node.js.

Download archive

Readme

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.

Changelog

1.0.0

First stable release of this library which implements subset of dart:io interfaces, including File System objects, HttpServer, Platform and other common classes.

Not all dart:io interfaces are covered yet. Feel free to file an issue on Github if you need a specific class implemented in node_io.

  • Complete file system implementations for Directory, File, RandomAccessFile, Link.
  • Added STATUS.md which reflects coverage of already implemented or exported dart:io APIs.

1.0.0-dev.10.0

  • Fixed NodeHttpResponse.redirect failing to convert Uri to string.

1.0.0-dev.9.0

  • Upgraded to latest build_node_compilers (0.2.0)

1.0.0-dev.8.0

  • Fixed: analysis warnings with latest Pub and Dart SDK.

1.0.0-dev.7.0

  • Fixed: handling errors in Directory.delete.
  • Fixed: handling relative paths in Directory.list.
  • Fixed: strong mode issues in Directory and File.
  • Added: File.create, File.delete, File.readAsString, File.rename, File.writeAsBytes, File.writeAsString.
  • Fixed: handling errors in File.open, File.stat, File.statSync.
  • Fixed: converting byte data in NodeIOSink.
  • Added: Minimal scaffold for Link FS entities.

1.0.0-dev.6.0

  • Upgraded to latest build_node_compilers.

1.0.0-dev.5.0

  • Fixed deprecation warnings with Dart 2 dev 61 SDK version.

1.0.0-dev.4.0

  • Fixed deprecation warnings with latest Dart 2 dev SDK.
  • Refactored HttpHeaders to not rely on Node.js API introduced in v7.7.0 Allows using this wrapper in Google Cloud Functions environment which runs on Node.js 6.x (LTS).

1.0.0-dev.3.0

  • Allow list values in HttpHeaders.set.

1.0.0-dev.2.0

  • Complete implementation of InternetAddress.

1.0.0-dev.1.0

  • Split from node_interop.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add node_io
pubspec.yaml
name: node_io
description: Like dart:io but with Node.js.
version: 1.0.0
homepage: https://github.com/pulyaevskiy/node-interop
author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>

environment:
  sdk: '>=2.1.0 <3.0.0'

dependencies:
  node_interop: ^1.0.1
  path: ^1.6.2

dev_dependencies:
  js: ^0.6.0
  test: ^1.0.0
  build_runner: ^1.0.0
  build_node_compilers: ^0.2.0
  build_test:

Version history

VersionPublishedArchiveSHA-256
1.0.0-dev.1.02018-02-13T23:10:32.408107ZDownload9d84d48831371ba74c0d7ae7feca580fd24c3563f1ba1aca4b17fe2930e2c6a5
1.0.0-dev.2.02018-02-14T04:57:26.947413ZDownloaddc4e4557fd35eb3b5e7e499ee1d41efb4b2f36444eb165fe73fbe79a6c323615
1.0.0-dev.3.02018-04-16T22:32:19.794365ZDownloadbd03bd1dc00ceefbf264858cd0d40780f155a23354b00543b7e6ed91e6b4db83
1.0.0-dev.4.02018-06-06T19:31:21.411866ZDownload8cf015788bf9a881a7bc4e3b457b5ee4be9b2674a3579d94743bc2d2cafaeeae
1.0.0-dev.5.02018-06-11T21:42:18.626112ZDownloaddfbcbf2092e5aa037f6f2017c54590209167e6c2dc6afb422e279057a52a2b33
1.0.0-dev.6.02018-06-22T17:56:46.229761ZDownload6731f9b2fa549f481df2b2fa36ff26c211d4b4c2a1566384e671c4aad3e5c247
1.0.0-dev.7.02018-06-25T23:17:13.450306ZDownloadb675ab6bfefad7a965a05c25027f1b3dec5536153bab4ea5802a37a1b5b7fea5
1.0.0-dev.8.02018-07-24T05:35:35.404135ZDownloadfeee2467609e65d817cdbb90996a3dc8b69229febc164d89387f8ba578cafe1f
1.0.0-dev.9.02018-10-05T01:17:59.218931ZDownload3218c80f41c266ca5e9816932813a20366a21213f6e026869b554501669a1839
1.0.0-dev.10.02018-11-07T17:43:14.629621ZDownload45c46fb2976d50f8ffa79692a82af2b1efde8a02973991590d63550bfc38182a
1.0.02019-05-17T05:17:35.721906ZDownload13414536f2a2f8f86124f6fbc7339e56e04eef0664290f9723d93cac34b6ca82
1.0.12019-05-22T02:57:39.199780ZDownload8f212f11fc6a036e3006a956789a860d7f21fed371398ffd38161927e18e2346
1.0.1+12019-06-21T21:37:44.186972ZDownload6e45de542a63a53e64dffae4ea4172a241db7c322e4da0805bddc86b46288d1b
1.0.1+22019-07-14T18:59:01.946117ZDownload044eec94b46ab40ab99eca3d876c14052d89ce858b2b2a5c3e71810ea2fc63a4
1.1.02020-05-07T06:21:47.511075ZDownload9517531c717300c363f388c2c1ca0d8e2f8a3f5bd74b60cb5049946c82cfd457
1.1.12020-05-13T05:19:07.380463ZDownloaddd801d4b02543ac44af8869577a0a8a51bd92a886c4f8057664dd2514ef17b73
1.2.02020-11-21T19:04:17.193579ZDownload36b74b2bcea9aa7484caa91e24bddde3f56e87fdc84f4da1cab7522a4b3680fe
2.0.02021-04-26T20:30:31.777378ZDownloadc1b1937a0474dc561c7a9cc666dcace029b2e97d846c30e8012c717ffd73a616
2.1.02021-05-24T23:25:26.541735ZDownloadaa8df2226b3b093e65f636edf7d0bfc8ac5f9c5ef2ed8d4950ed59911ee6b5d7
2.2.02022-09-02T22:19:12.524144ZDownload967c553b451eae844c72414426b71c1a414be6a3cd1b4db77406e9423d9652e3
2.3.02024-03-12T05:05:21.030190ZDownload20786697127d5f1aa130206dafea67da212586f9d86214a16b63b2c37d4caf80

Dependencies

node_interop "^1.0.1"

path "^1.6.2"