update, text, response
This commit is contained in:
12
node_modules/to-buffer/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/to-buffer/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb, mafintosh]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/to-buffer
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
9
node_modules/to-buffer/.travis.yml
generated
vendored
9
node_modules/to-buffer/.travis.yml
generated
vendored
@@ -1,9 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "5"
|
||||
- "4"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
81
node_modules/to-buffer/CHANGELOG.md
generated
vendored
Normal file
81
node_modules/to-buffer/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.2.2](https://github.com/browserify/to-buffer/compare/v1.2.1...v1.2.2) - 2025-09-24
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] handle SlowBuffers in node 0.10 [`ca20eaa`](https://github.com/browserify/to-buffer/commit/ca20eaad8c9cbd6e3e6e99880b2b1c95abe62566)
|
||||
- [Refactor] use `SafeBuffer.isBuffer` instead of `instanceof` [`81283c1`](https://github.com/browserify/to-buffer/commit/81283c14b585c0e921e04f327381e975cc8561bb)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`c7bc986`](https://github.com/browserify/to-buffer/commit/c7bc986d378ce4bdf2dac75612b45b0f618f26d6)
|
||||
- [meta] since tests are npmignored, also npmignore test config files [`866639c`](https://github.com/browserify/to-buffer/commit/866639cf294799f8c0397153e5876ae1e6992a57)
|
||||
|
||||
## [v1.2.1](https://github.com/browserify/to-buffer/compare/v1.2.0...v1.2.1) - 2025-06-19
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] handle non-Uint8Arrays in node < 3 [`7f8a881`](https://github.com/browserify/to-buffer/commit/7f8a881929133935f8e15ffd60d6dbbc513b2c5f)
|
||||
- [Tests] add coverage [`286c96a`](https://github.com/browserify/to-buffer/commit/286c96a52cfeee14a2ba974d78071bdd667e9360)
|
||||
- [Fix] provide a fallback for engines without `ArrayBuffer.isView` [`e336166`](https://github.com/browserify/to-buffer/commit/e336166b8f4bf13860bafa191ee1ec53fca2e331)
|
||||
- [Fix] correct error message [`b45247e`](https://github.com/browserify/to-buffer/commit/b45247ed337fb44b2c8d74a14e8f86d985119fb9)
|
||||
|
||||
## [v1.2.0](https://github.com/browserify/to-buffer/compare/v1.1.1...v1.2.0) - 2025-06-17
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] replace with implementation from cipher-base [`970adb5`](https://github.com/browserify/to-buffer/commit/970adb5523efdaa13f5ecb82967fc9f617865549)
|
||||
- [Tests] migrate from travis to GHA [`8084393`](https://github.com/browserify/to-buffer/commit/808439337ca9ac3dbb8399079aaa2a4cb738627c)
|
||||
- [eslint] fix whitespace [`a62e651`](https://github.com/browserify/to-buffer/commit/a62e651b661adf98c17e9e486b55bb8ff0ffb8c9)
|
||||
- [eslint] fix semicolon usage [`4d85c63`](https://github.com/browserify/to-buffer/commit/4d85c6318c72feae8d19037937154f9b99ba266f)
|
||||
- [meta] add `auto-changelog` [`aa0279c`](https://github.com/browserify/to-buffer/commit/aa0279c5199ca7fe39acfb950a4c824e97f06232)
|
||||
- [readme] update URLs, add badges [`ff77d90`](https://github.com/browserify/to-buffer/commit/ff77d90b89de7b02538ecb2d6a89da086093bed8)
|
||||
- [lint] switch to eslint [`e45f467`](https://github.com/browserify/to-buffer/commit/e45f467c7229e632cd3c10fc02895ba4d3204bbe)
|
||||
- [Fix] validate that arrays contain valid byte values [`c2fb75e`](https://github.com/browserify/to-buffer/commit/c2fb75edf2fb113d58599e990f86574b4dfa62d8)
|
||||
- [Fix] restore previous implementation Array behavior [`cb93b75`](https://github.com/browserify/to-buffer/commit/cb93b75a79caa9897f6c29ecde91f4ae35f704fe)
|
||||
- [Tests] add nyc for coverage [`ab7026e`](https://github.com/browserify/to-buffer/commit/ab7026e36e3716c8101229f426e7f4571e55794b)
|
||||
- [Refactor] use `safe-buffer`.from instead of `buffer-from` [`8e01307`](https://github.com/browserify/to-buffer/commit/8e01307191245044469e47695c5c2675b85e84e9)
|
||||
- [Fix] Replace Buffer.from with `buffer-from` [`d652e54`](https://github.com/browserify/to-buffer/commit/d652e54e2396a47358a553c447e0f338b4c2dc67)
|
||||
- [Tests] use `deepEqual` over `same` alias [`66a5548`](https://github.com/browserify/to-buffer/commit/66a55480258011bb5d81c5aad1360468f418d0b4)
|
||||
- [meta] add `npmignore` [`90ce602`](https://github.com/browserify/to-buffer/commit/90ce6023737d50521aff44d87063db1e3f7e352a)
|
||||
- [Tests] move into a test dir, update tape [`08aea81`](https://github.com/browserify/to-buffer/commit/08aea81b61b90d1fcb7e9275b5b0ba718531d9a8)
|
||||
- Only apps should have lockfiles [`16ccceb`](https://github.com/browserify/to-buffer/commit/16ccceb23f350be16e80111188c90a3492916f5d)
|
||||
- [Tests] add coverage [`d2cba2e`](https://github.com/browserify/to-buffer/commit/d2cba2ec76ed43c83e2a7a91f58fa7640aeb61e9)
|
||||
- [meta] update description [`2cf2a20`](https://github.com/browserify/to-buffer/commit/2cf2a200a31f9543d2e8a24b5ea0e8bd843166c3)
|
||||
- [Fix] add `safe-buffer`, missing from 970adb5 [`d9a0dea`](https://github.com/browserify/to-buffer/commit/d9a0dead7c638d188f8b48cdf2b5fd6cfa886071)
|
||||
- [meta] temporarily limit support to node v0.10 [`8dca458`](https://github.com/browserify/to-buffer/commit/8dca458bd9a2c6b84d6e3a1996e41b242fe1c49a)
|
||||
- [meta] add missing `engines.node` [`35bdfcb`](https://github.com/browserify/to-buffer/commit/35bdfcb3a71dfbd5b35d35250c9dac19c99f4197)
|
||||
- [Dev Deps] add missing peer dep [`220143f`](https://github.com/browserify/to-buffer/commit/220143f1f6e47154380c27a2d88ce300104007fa)
|
||||
- [meta] add `sideEffects` flag [`cd37473`](https://github.com/browserify/to-buffer/commit/cd374738d24b22b029862b3c27b9e247d4e62daf)
|
||||
|
||||
## [v1.1.1](https://github.com/browserify/to-buffer/compare/v1.1.0...v1.1.1) - 2018-04-26
|
||||
|
||||
### Commits
|
||||
|
||||
- use Buffer.from when avail [`eebe20e`](https://github.com/browserify/to-buffer/commit/eebe20e0603e2c6a542b00316f1661741fdf1124)
|
||||
|
||||
## [v1.1.0](https://github.com/browserify/to-buffer/compare/v1.0.1...v1.1.0) - 2017-04-12
|
||||
|
||||
### Merged
|
||||
|
||||
- Fix typo [`#2`](https://github.com/browserify/to-buffer/pull/2)
|
||||
|
||||
### Commits
|
||||
|
||||
- support arrays as well [`ef98c82`](https://github.com/browserify/to-buffer/commit/ef98c82791d71601077577e84c4614ec2d05f086)
|
||||
|
||||
## [v1.0.1](https://github.com/browserify/to-buffer/compare/v1.0.0...v1.0.1) - 2016-02-15
|
||||
|
||||
### Commits
|
||||
|
||||
- fix desc [`7d50a7c`](https://github.com/browserify/to-buffer/commit/7d50a7c69c3eef77448893744ada16601c44af6a)
|
||||
|
||||
## v1.0.0 - 2016-02-15
|
||||
|
||||
### Commits
|
||||
|
||||
- first commit [`8361941`](https://github.com/browserify/to-buffer/commit/8361941d7acb3b82c732ecd10bdb047da5af2028)
|
||||
- add travis [`de911b5`](https://github.com/browserify/to-buffer/commit/de911b5364558561d84b4ec9e43c6a0fe1c8e904)
|
||||
45
node_modules/to-buffer/README.md
generated
vendored
45
node_modules/to-buffer/README.md
generated
vendored
@@ -1,23 +1,44 @@
|
||||
# to-buffer
|
||||
# to-buffer <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back.
|
||||
|
||||
```
|
||||
npm install to-buffer
|
||||
```
|
||||
|
||||
[](https://travis-ci.org/mafintosh/to-buffer)
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var toBuffer = require('to-buffer')
|
||||
console.log(toBuffer('hi')) // <Buffer 68 69>
|
||||
console.log(toBuffer(Buffer('hi'))) // <Buffer 68 69>
|
||||
console.log(toBuffer('6869', 'hex')) // <Buffer 68 69>
|
||||
console.log(toBuffer(43)) // throws
|
||||
var toBuffer = require('to-buffer');
|
||||
|
||||
console.log(toBuffer('hi')); // <Buffer 68 69>
|
||||
console.log(toBuffer(Buffer('hi'))); // <Buffer 68 69>
|
||||
console.log(toBuffer('6869', 'hex')); // <Buffer 68 69>
|
||||
console.log(toBuffer(43)); // throws
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
[1]: https://npmjs.org/package/to-buffer
|
||||
[2]: https://versionbadg.es/browserify/to-buffer.svg
|
||||
[5]: https://david-dm.org/browserify/to-buffer.svg
|
||||
[6]: https://david-dm.org/browserify/to-buffer
|
||||
[7]: https://david-dm.org/browserify/to-buffer/dev-status.svg
|
||||
[8]: https://david-dm.org/browserify/to-buffer#info=devDependencies
|
||||
[11]: https://nodei.co/npm/to-buffer.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/to-buffer.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/to-buffer.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=to-buffer
|
||||
[codecov-image]: https://codecov.io/gh/browserify/to-buffer/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/browserify/to-buffer/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/to-buffer
|
||||
[actions-url]: https://github.com/browserify/to-buffer/actions
|
||||
|
||||
117
node_modules/to-buffer/index.js
generated
vendored
117
node_modules/to-buffer/index.js
generated
vendored
@@ -1,14 +1,109 @@
|
||||
module.exports = toBuffer
|
||||
'use strict';
|
||||
|
||||
var makeBuffer = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from : bufferFrom
|
||||
var Buffer = require('safe-buffer').Buffer;
|
||||
var isArray = require('isarray');
|
||||
var typedArrayBuffer = require('typed-array-buffer');
|
||||
|
||||
function bufferFrom (buf, enc) {
|
||||
return new Buffer(buf, enc)
|
||||
}
|
||||
var isView = ArrayBuffer.isView || function isView(obj) {
|
||||
try {
|
||||
typedArrayBuffer(obj);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function toBuffer (buf, enc) {
|
||||
if (Buffer.isBuffer(buf)) return buf
|
||||
if (typeof buf === 'string') return makeBuffer(buf, enc)
|
||||
if (Array.isArray(buf)) return makeBuffer(buf)
|
||||
throw new Error('Input should be a buffer or a string')
|
||||
}
|
||||
var useUint8Array = typeof Uint8Array !== 'undefined';
|
||||
var useArrayBuffer = typeof ArrayBuffer !== 'undefined'
|
||||
&& typeof Uint8Array !== 'undefined';
|
||||
var useFromArrayBuffer = useArrayBuffer && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT);
|
||||
|
||||
module.exports = function toBuffer(data, encoding) {
|
||||
if (Buffer.isBuffer(data)) {
|
||||
if (data.constructor && !('isBuffer' in data)) {
|
||||
// probably a SlowBuffer
|
||||
return Buffer.from(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
if (typeof data === 'string') {
|
||||
return Buffer.from(data, encoding);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrap any TypedArray instances and DataViews
|
||||
* Makes sense only on engines with full TypedArray support -- let Buffer detect that
|
||||
*/
|
||||
if (useArrayBuffer && isView(data)) {
|
||||
// Bug in Node.js <6.3.1, which treats this as out-of-bounds
|
||||
if (data.byteLength === 0) {
|
||||
return Buffer.alloc(0);
|
||||
}
|
||||
|
||||
// When Buffer is based on Uint8Array, we can just construct it from ArrayBuffer
|
||||
if (useFromArrayBuffer) {
|
||||
var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
||||
/*
|
||||
* Recheck result size, as offset/length doesn't work on Node.js <5.10
|
||||
* We just go to Uint8Array case if this fails
|
||||
*/
|
||||
if (res.byteLength === data.byteLength) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to Uint8Array bytes and then to Buffer
|
||||
var uint8 = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
||||
var result = Buffer.from(uint8);
|
||||
|
||||
/*
|
||||
* Let's recheck that conversion succeeded
|
||||
* We have .length but not .byteLength when useFromArrayBuffer is false
|
||||
*/
|
||||
if (result.length === data.byteLength) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Uint8Array in engines where Buffer.from might not work with ArrayBuffer, just copy over
|
||||
* Doesn't make sense with other TypedArray instances
|
||||
*/
|
||||
if (useUint8Array && data instanceof Uint8Array) {
|
||||
return Buffer.from(data);
|
||||
}
|
||||
|
||||
var isArr = isArray(data);
|
||||
if (isArr) {
|
||||
for (var i = 0; i < data.length; i += 1) {
|
||||
var x = data[i];
|
||||
if (
|
||||
typeof x !== 'number'
|
||||
|| x < 0
|
||||
|| x > 255
|
||||
|| ~~x !== x // NaN and integer check
|
||||
) {
|
||||
throw new RangeError('Array items must be numbers in the range 0-255.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Old Buffer polyfill on an engine that doesn't have TypedArray support
|
||||
* Also, this is from a different Buffer polyfill implementation then we have, as instanceof check failed
|
||||
* Convert to our current Buffer implementation
|
||||
*/
|
||||
if (
|
||||
isArr || (
|
||||
Buffer.isBuffer(data)
|
||||
&& data.constructor
|
||||
&& typeof data.constructor.isBuffer === 'function'
|
||||
&& data.constructor.isBuffer(data)
|
||||
)
|
||||
) {
|
||||
return Buffer.from(data);
|
||||
}
|
||||
|
||||
throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.');
|
||||
};
|
||||
|
||||
21
node_modules/to-buffer/node_modules/isarray/LICENSE
generated
vendored
Normal file
21
node_modules/to-buffer/node_modules/isarray/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
38
node_modules/to-buffer/node_modules/isarray/README.md
generated
vendored
Normal file
38
node_modules/to-buffer/node_modules/isarray/README.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers and deprecated Node.js versions.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/isarray)
|
||||
[](https://www.npmjs.org/package/isarray)
|
||||
|
||||
[
|
||||
](https://ci.testling.com/juliangruber/isarray)
|
||||
|
||||
__Just use Array.isArray directly__, unless you need to support those older versions.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/node-browserify).
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
5
node_modules/to-buffer/node_modules/isarray/index.js
generated
vendored
Normal file
5
node_modules/to-buffer/node_modules/isarray/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var toString = {}.toString;
|
||||
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return toString.call(arr) == '[object Array]';
|
||||
};
|
||||
48
node_modules/to-buffer/node_modules/isarray/package.json
generated
vendored
Normal file
48
node_modules/to-buffer/node_modules/isarray/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "isarray",
|
||||
"description": "Array#isArray for older browsers",
|
||||
"version": "2.0.5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "~2.13.4"
|
||||
},
|
||||
"keywords": [
|
||||
"browser",
|
||||
"isarray",
|
||||
"array"
|
||||
],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/17..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test.js"
|
||||
}
|
||||
}
|
||||
110
node_modules/to-buffer/package.json
generated
vendored
110
node_modules/to-buffer/package.json
generated
vendored
@@ -1,52 +1,62 @@
|
||||
{
|
||||
"_from": "to-buffer@^1.1.1",
|
||||
"_id": "to-buffer@1.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==",
|
||||
"_location": "/to-buffer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "to-buffer@^1.1.1",
|
||||
"name": "to-buffer",
|
||||
"escapedName": "to-buffer",
|
||||
"rawSpec": "^1.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tar-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
|
||||
"_shasum": "493bd48f62d7c43fcded313a03dcadb2e1213a80",
|
||||
"_spec": "to-buffer@^1.1.1",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/tar-stream",
|
||||
"author": {
|
||||
"name": "Mathias Buus",
|
||||
"url": "@mafintosh"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/to-buffer/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back",
|
||||
"devDependencies": {
|
||||
"standard": "^6.0.5",
|
||||
"tape": "^4.4.0"
|
||||
},
|
||||
"homepage": "https://github.com/mafintosh/to-buffer",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "to-buffer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mafintosh/to-buffer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
"name": "to-buffer",
|
||||
"version": "1.2.2",
|
||||
"description": "Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npx npm@\">= 10.2\" audit --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/browserify/to-buffer.git"
|
||||
},
|
||||
"author": "Mathias Buus (@mafintosh)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/browserify/to-buffer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/browserify/to-buffer",
|
||||
"dependencies": {
|
||||
"isarray": "^2.0.5",
|
||||
"safe-buffer": "^5.2.1",
|
||||
"typed-array-buffer": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.2.0",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"available-typed-arrays": "^1.0.7",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "=8.8.0",
|
||||
"for-each": "^0.3.5",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"tape": "^5.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows",
|
||||
".eslintrc",
|
||||
".nycrc",
|
||||
"test"
|
||||
]
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
|
||||
26
node_modules/to-buffer/test.js
generated
vendored
26
node_modules/to-buffer/test.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
var tape = require('tape')
|
||||
var toBuffer = require('./')
|
||||
|
||||
tape('buffer returns buffer', function (t) {
|
||||
t.same(toBuffer(Buffer('hi')), Buffer('hi'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('string returns buffer', function (t) {
|
||||
t.same(toBuffer('hi'), Buffer('hi'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('string + enc returns buffer', function (t) {
|
||||
t.same(toBuffer('6869', 'hex'), Buffer('hi'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('other input throws', function (t) {
|
||||
try {
|
||||
toBuffer(42)
|
||||
} catch (err) {
|
||||
t.same(err.message, 'Input should be a buffer or a string')
|
||||
t.end()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user