Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/busterc/readfile-split
:heavy_division_sign: Read a file, splitting it's contents into an Array (for Node)
https://github.com/busterc/readfile-split
filesystem fs readfile
Last synced: about 1 month ago
JSON representation
:heavy_division_sign: Read a file, splitting it's contents into an Array (for Node)
- Host: GitHub
- URL: https://github.com/busterc/readfile-split
- Owner: busterc
- License: isc
- Created: 2015-09-04T22:14:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-25T21:43:51.000Z (over 6 years ago)
- Last Synced: 2024-10-31T17:54:15.579Z (3 months ago)
- Topics: filesystem, fs, readfile
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readfile-split [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
> Read a file into an array## Install
```sh
$ npm install --save readfile-split
```## Usage
```js
var readfileSplit = require('readfile-split');// readfileSplit(filename[, options], callback)
// options with defaults
var options = {
// fs.readFile specific options
encoding: null,
flag: 'r',// readfileSplit specific options
emptyLines: true,
trimLines: true,
withSeperator: false,
seperator: /\r?\n/
};readfileSplit('/somewhere/somefile', options, console.log);
// > null [ 'Hello,', '', 'Don\'t worry.', 'Be happy.', '', 'Goodbye!', '' ]options.emptyLines = false;
readfileSplit('/somewhere/somefile', options, console.log);
// > null [ 'Hello,', 'Don\'t worry.', 'Be happy.', 'Goodbye!' ]options.seperator = '.';
readfileSplit('/somewhere/somefile', options, console.log);
// > null [ 'Hello,\n\nDon\'t worry', 'Be happy', 'Goodbye!' ]options.withSeperator = true;
readfileSplit('/somewhere/somefile', options, console.log);
// > null [ 'Hello,\n\nDon\'t worry.', 'Be happy.', 'Goodbye!' ]// etc.
```## License
ISC © [Buster Collings](http://about.me/buster)
[npm-image]: https://badge.fury.io/js/readfile-split.svg
[npm-url]: https://npmjs.org/package/readfile-split
[travis-image]: https://travis-ci.org/busterc/readfile-split.svg?branch=master
[travis-url]: https://travis-ci.org/busterc/readfile-split
[daviddm-image]: https://david-dm.org/busterc/readfile-split.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/busterc/readfile-split