Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
decreased by-14.89%
Maintainers
1
Weekly downloads
 
Created

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

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc