fileslice

1.0.1 • Public • Published

fileslice

npm version dependencies Build Status Build status

Copy a slice of a file.

Installation

Install fileslice by running:

$ npm install --save fileslice

Documentation

fileslice.copy(String file, String output, Object range, Function callback)

Copy a slice of file to output.

The slice is determined by the range object which contains two fields:

  • start is the number of bytes determining where to start copying from.
  • end is the number of bytes determining where to stop copying.

The callback received a single argument: (error).

The function is implemented using streams, so you can copy big file slices without worrying about memory.

Example:

var fileslice = require('fileslice');
 
fileslice.copy('input/file', 'output/file', {
    start: 512,
    end: 2048
}, function(error) {
    if(error) throw error;
    console.log('The slice of the file was copied.');
});

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

Support

If you're having any problem, please raise an issue on GitHub.

License

The project is licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i fileslice

Weekly Downloads

3

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jviotti