Socket
Socket
Sign inDemoInstall

node-delete-partial

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    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 f


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Install size
8.94 kB
Created
Weekly downloads
 

Readme

Source

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.








:open_file_folder: Index

1. Install

2. Large File Usage Example

3. Small File Usage Example

4. API

5. Author

6. Contribute

7. License








:gem: 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

:tada: 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);







:tada: 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');
});







:nut_and_bolt: API


:large_blue_diamond: deletePartialStream(lines)


Parameters:
NameTypeRequiredDescription
linesnumberNODelete the number of lines from the beginning of the file. Default is 1.

:large_blue_diamond: deletePartials(path[, options], callback)


Parameters:
NameTypeRequiredDescription
pathstringYESFile to delete from and update.
optionsObjectNOSee below.
callbackFunctionNOThe 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.







:santa: Author

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








:clap: Contribute

Pull requests are welcomed.


:tophat: Contributors

Contributors will be posted here.


:baby: Beginners

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



LueHsoft LueH LABS Lue Hang luehang

:page_facing_up: License

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

Keywords

FAQs

Last updated on 24 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc