You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

strip-eof

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strip-eof

Strip the final newline character from a string/buffer


Version published
Weekly downloads
11M
decreased by-2.16%
Maintainers
1
Install size
3.65 kB
Created
Weekly downloads
 

Package description

What is strip-eof?

The strip-eof npm package is a utility that removes the end-of-file (EOF) newline character from a string or buffer. This can be useful in various scenarios where you need to ensure that the string or buffer does not end with a newline character.

What are strip-eof's main functionalities?

Remove EOF newline from a string

This feature allows you to remove the EOF newline character from a string. In the example, the input string 'Hello, world!\n' is processed by strip-eof to produce 'Hello, world!' without the trailing newline.

const stripEof = require('strip-eof');
const input = 'Hello, world!\n';
const output = stripEof(input);
console.log(output); // 'Hello, world!'

Remove EOF newline from a buffer

This feature allows you to remove the EOF newline character from a buffer. In the example, the input buffer containing 'Hello, world!\n' is processed by strip-eof to produce a buffer containing 'Hello, world!' without the trailing newline.

const stripEof = require('strip-eof');
const input = Buffer.from('Hello, world!\n');
const output = stripEof(input);
console.log(output.toString()); // 'Hello, world!'

Other packages similar to strip-eof

Readme

Source

strip-eof Build Status

Strip the End-Of-File (EOF) character from a string/buffer

Install

$ npm install strip-eof

Usage

const stripEof = require('strip-eof');

stripEof('foo\nbar\n\n');
//=> 'foo\nbar\n'

stripEof(Buffer.from('foo\nbar\n\n')).toString();
//=> 'foo\nbar\n'

License

MIT © Sindre Sorhus

Keywords

FAQs

Package last updated on 28 Oct 2018

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc