strip-bom-buf
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -1,2 +0,2 @@ | ||
/// <reference types="node"/> | ||
import Buffer from 'node:buffer'; | ||
@@ -8,4 +8,4 @@ /** | ||
``` | ||
import * as fs from 'fs'; | ||
import stripBomBuffer = require('strip-bom-buf'); | ||
import fs from 'node:fs'; | ||
import stripBomBuffer from 'strip-bom-buf'; | ||
@@ -16,4 +16,2 @@ stripBomBuffer(fs.readFileSync('unicorn.txt')); | ||
*/ | ||
declare function stripBomBuffer(buffer: Buffer): Buffer; | ||
export = stripBomBuffer; | ||
export default function stripBomBuffer(buffer: Buffer): Buffer; |
10
index.js
@@ -1,7 +0,7 @@ | ||
'use strict'; | ||
const isUtf8 = require('is-utf8'); | ||
import {Buffer} from 'node:buffer'; | ||
import isUtf8 from 'is-utf8'; | ||
module.exports = buffer => { | ||
export default function strimBomBuffer(buffer) { | ||
if (!Buffer.isBuffer(buffer)) { | ||
throw new TypeError(`Expected a Buffer, got ${typeof buffer}`); | ||
throw new TypeError(`Expected a \`Buffer\`, got \`${typeof buffer}\``); | ||
} | ||
@@ -14,2 +14,2 @@ | ||
return buffer; | ||
}; | ||
} |
{ | ||
"name": "strip-bom-buf", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Strip UTF-8 byte order mark (BOM) from a buffer", | ||
"license": "MIT", | ||
"repository": "sindresorhus/strip-bom-buf", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -41,7 +44,7 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/node": "^11.13.8", | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"@types/node": "^16.6.1", | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# strip-bom-buf [![Build Status](https://travis-ci.org/sindresorhus/strip-bom-buf.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-bom-buf) | ||
# strip-bom-buf | ||
@@ -9,3 +9,2 @@ > Strip UTF-8 [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM) from a buffer | ||
## Install | ||
@@ -17,8 +16,7 @@ | ||
## Usage | ||
```js | ||
const fs = require('fs'); | ||
const stripBomBuffer = require('strip-bom-buf'); | ||
import fs from 'node:fs'; | ||
import stripBomBuffer from 'strip-bom-buf'; | ||
@@ -29,3 +27,2 @@ stripBomBuffer(fs.readFileSync('unicorn.txt')); | ||
## Related | ||
@@ -35,6 +32,1 @@ | ||
- [strip-bom-stream](https://github.com/sindresorhus/strip-bom-stream) - Stream version of this module | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
Yes
3389
23
29