Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

node-delete-partial

2.0.0 • Public • Published

LueHsoft LueH LABS Lue Hang luehang

Node Delete Partial

An easy and simple to use Node module to efficiently remove the first X number of lines from an inputstream. It uses streams, which means it doesn't need to load whole files in memory, so it is way more efficient and fast, as well can work on very large files without filling memory on the hardware.

Learn more about the installation and how to use this package in the updated documentation page.








📂 Index

1. Install

2. Large File Usage Example

3. Small File Usage Example

4. API

5. Author

6. Contribute

7. License








💎 Install

Type in the following to the command line to install the dependency.

$ npm install --save node-delete-partial

or

$ yarn add node-delete-partial


LueHsoft LueH LABS Lue Hang luehang

🎉 Large File Usage Example

var { deletePartialStream } = require('node-delete-partial');
var fs = require('fs');
 
var input = fs.createReadStream(process.cwd() + '/input.txt');
var output = fs.createWriteStream(process.cwd() + '/output.txt');
 
input
    // delete 5 lines from beginning of file
    .pipe(deletePartialStream(5))
    .pipe(output);







🎉 Small File Usage Example

var { deletePartials } = require('node-delete-partial');
 
var filePath = process.cwd() + '/file.txt';
 
deletePartials(filePath, { lines: 5 }, function (err) {
    if (err) {
        console.log(err);
    }
    console.log('Completed');
});







🔩 API


🔷 deletePartialStream(lines)


Parameters:

Name Type Required Description
lines number NO Delete the number of lines from the beginning of the file. Default is 1.

🔷 deletePartials(path[, options], callback)


Parameters:

Name Type Required Description
path string YES File to delete from and update.
options Object NO See below.
callback Function NO The callback gets one argument (err).

Valid options keys are:

  • "lines" (number) - Delete the number of lines from the beginning of the file. Default is 1.







🎅 Author

Free and made possible along with costly maintenance and updates by Lue Hang (the author).








👏 Contribute

Pull requests are welcomed.


🎩 Contributors

Contributors will be posted here.


👶 Beginners

Not sure where to start, or a beginner? Take a look at the issues page.



LueHsoft LueH LABS Lue Hang luehang

📄 License

MIT © Lue Hang, as found in the LICENSE file.

Install

npm i node-delete-partial

DownloadsWeekly Downloads

5

Version

2.0.0

License

MIT

Unpacked Size

9.16 kB

Total Files

4

Last publish

Collaborators

  • avatar