@aws-sdk/util-buffer-from
Advanced tools
Comparing version 3.310.0 to 3.374.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fromString = exports.fromArrayBuffer = void 0; | ||
const is_array_buffer_1 = require("@aws-sdk/is-array-buffer"); | ||
const buffer_1 = require("buffer"); | ||
const fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => { | ||
if (!(0, is_array_buffer_1.isArrayBuffer)(input)) { | ||
throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); | ||
} | ||
return buffer_1.Buffer.from(input, offset, length); | ||
}; | ||
exports.fromArrayBuffer = fromArrayBuffer; | ||
const fromString = (input, encoding) => { | ||
if (typeof input !== "string") { | ||
throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); | ||
} | ||
return encoding ? buffer_1.Buffer.from(input, encoding) : buffer_1.Buffer.from(input); | ||
}; | ||
exports.fromString = fromString; | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("@smithy/util-buffer-from"), exports); |
@@ -1,14 +0,1 @@ | ||
import { isArrayBuffer } from "@aws-sdk/is-array-buffer"; | ||
import { Buffer } from "buffer"; | ||
export const fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => { | ||
if (!isArrayBuffer(input)) { | ||
throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); | ||
} | ||
return Buffer.from(input, offset, length); | ||
}; | ||
export const fromString = (input, encoding) => { | ||
if (typeof input !== "string") { | ||
throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); | ||
} | ||
return encoding ? Buffer.from(input, encoding) : Buffer.from(input); | ||
}; | ||
export * from "@smithy/util-buffer-from"; |
@@ -1,13 +0,1 @@ | ||
import { Buffer } from "buffer"; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const fromArrayBuffer: (input: ArrayBuffer, offset?: number, length?: number) => Buffer; | ||
/** | ||
* @internal | ||
*/ | ||
export type StringEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex"; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const fromString: (input: string, encoding?: StringEncoding) => Buffer; | ||
export * from "@smithy/util-buffer-from"; |
@@ -1,19 +0,1 @@ | ||
import { Buffer } from "buffer"; | ||
export declare const fromArrayBuffer: ( | ||
input: ArrayBuffer, | ||
offset?: number, | ||
length?: number | ||
) => Buffer; | ||
export type StringEncoding = | ||
| "ascii" | ||
| "utf8" | ||
| "utf16le" | ||
| "ucs2" | ||
| "base64" | ||
| "latin1" | ||
| "binary" | ||
| "hex"; | ||
export declare const fromString: ( | ||
input: string, | ||
encoding?: StringEncoding | ||
) => Buffer; | ||
export * from "@smithy/util-buffer-from"; |
{ | ||
"name": "@aws-sdk/util-buffer-from", | ||
"version": "3.310.0", | ||
"version": "3.374.0", | ||
"scripts": { | ||
@@ -12,3 +12,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo", | ||
"test": "jest" | ||
"test": "exit 0" | ||
}, | ||
@@ -21,3 +21,3 @@ "author": { | ||
"dependencies": { | ||
"@aws-sdk/is-array-buffer": "3.310.0", | ||
"@smithy/util-buffer-from": "^1.0.1", | ||
"tslib": "^2.5.0" | ||
@@ -24,0 +24,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13629
7
1
1
+ Added@smithy/is-array-buffer@1.1.0(transitive)
+ Added@smithy/util-buffer-from@1.1.0(transitive)
- Removed@aws-sdk/is-array-buffer@3.310.0
- Removed@aws-sdk/is-array-buffer@3.310.0(transitive)