JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 887
  • Score
    100M100P100Q98978F
  • License MIT

Pull streams implementation of a file reader

Package Exports

  • pull-file

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pull-file

This is a simple module which uses raw file reading methods available in the node fs module to read files on-demand. It's a work in progress and feedback is welcome :)

![Build Status] (https://travis-ci.org/DamonOehlman/pull-file.png?branch=master)

read(filename, opts)

Read from the target file as required:

var file = require('pull-file');
var pull = require('pull-stream');

pull(
  file.read(__dirname +  '/bigfile'),
  pull.drain(console.log) // see the chunks :)
);

Through Streams

split(chunk)

Will collect pieces of the file until the split chunk is found, then it will pass on all the data collected prior to encountering the chunk. The split functionality works at a pure buffer level so if it is passed a string it will convert that into a Buffer before attempting the split operation.

Usage:

var file = require('pull-file');
var pull = require('pull-stream');

pull(
  file.read(__dirname + '/test.csv'),
  file.split('\n'),
  pull.drain(console.log) // log out lines
);