# @esm2cjs/strip-final-newline

> Strip the final newline character from a string/buffer. This is a fork of sindresorhus/strip-final-newline, but with CommonJS support.

Latest version **3.0.1-cjs.0** (published 2022-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @esm2cjs/strip-final-newline
pnpm add @esm2cjs/strip-final-newline
yarn add @esm2cjs/strip-final-newline
bun add @esm2cjs/strip-final-newline
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1-cjs.0 |
| Published | 2022-08-18 |
| First published | 2022-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dominic Griesel |
| Maintainers | alcalzone |
| Keywords | strip, trim, remove, delete, final, last, end, file, newline, linebreak, character, string, buffer |

## Links

- npm: https://www.npmjs.com/package/@esm2cjs/strip-final-newline
- Repository: https://github.com/esm2cjs/strip-final-newline
- Homepage: https://github.com/esm2cjs/strip-final-newline#readme
- Issues: https://github.com/esm2cjs/strip-final-newline/issues
- Funding: https://github.com/sponsors/AlCalzone
- npm.io page: https://npm.io/package/@esm2cjs/strip-final-newline

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 3.0.1-cjs.0 (latest) — 2022-08-18

## README

# @esm2cjs/strip-final-newline

This is a fork of https://github.com/sindresorhus/strip-final-newline, but automatically patched to support ESM **and** CommonJS, unlike the original repository.

## Install

Use an npm alias to install this package under the original name:
```
npm i strip-final-newline@npm:@esm2cjs/strip-final-newline
```

```jsonc
// package.json
"dependencies": {
    "strip-final-newline": "npm:@esm2cjs/strip-final-newline@^3.0.1-cjs.0"
}
```

> **Note:**
> We strive to use the same versions as the upstream package, but there was a mistake when publishing `3.0.0`.
> We fixed it, but had to re-publish this version as `3.0.1-cjs.0`.

## Usage

```js
// Using ESM import syntax
import stripFinalNewline from 'strip-final-newline';

// Using CommonJS require()
const stripFinalNewline = require('strip-final-newline').default;
```

> **Note:**
> Because the original module uses `export default`, you need to append `.default` to the `require()` call.


For more details, please see the original [repository](https://github.com/sindresorhus/strip-final-newline).

## Sponsoring

To support my efforts in maintaining the ESM/CommonJS hybrid, please sponsor [here](https://github.com/sponsors/AlCalzone).

To support the original author of the module, please sponsor [here](https://github.com/sindresorhus/strip-final-newline).

---
_Source: https://npm.io/package/@esm2cjs/strip-final-newline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
