# fileslice

> Copy a slice of a file

Latest version **1.0.1** (published 2017-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install fileslice
pnpm add fileslice
yarn add fileslice
bun add fileslice
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-07 |
| First published | 2015-04-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | Juan Cruz Viotti |
| Maintainers | jviotti |
| Keywords | git, wrap, wrapper |

## Links

- npm: https://www.npmjs.com/package/fileslice
- Repository: https://github.com/jviotti/fileslice
- Issues: https://github.com/jviotti/fileslice/issues
- npm.io page: https://npm.io/package/fileslice

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^3.7.0

## Recent versions

- 1.0.1 (latest) — 2017-08-07
- 1.0.0 — 2015-04-21

## README

fileslice
---------

[![npm version](https://badge.fury.io/js/fileslice.svg)](http://badge.fury.io/js/fileslice)
[![dependencies](https://david-dm.org/jviotti/fileslice.png)](https://david-dm.org/jviotti/fileslice.png)
[![Build Status](https://travis-ci.org/jviotti/fileslice.svg?branch=master)](https://travis-ci.org/jviotti/fileslice)
[![Build status](https://ci.appveyor.com/api/projects/status/l1kkquwc3n5mgwkm?svg=true)](https://ci.appveyor.com/project/jviotti/fileslice)

Copy a slice of a file.

Installation
------------

Install `fileslice` by running:

```sh
$ 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:

```javascript
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:

```sh
$ gulp test
```

Contribute
----------

- Issue Tracker: [github.com/jviotti/fileslice/issues](https://github.com/jviotti/fileslice/issues)
- Source Code: [github.com/jviotti/fileslice](https://github.com/jviotti/fileslice)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ gulp lint
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/jviotti/fileslice/issues/new) on GitHub.

License
-------

The project is licensed under the MIT license.

---
_Source: https://npm.io/package/fileslice · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
