🚑 Do not decode buffers to string
This commit is contained in:
parent
e952f714df
commit
520f9c2e39
3 changed files with 0 additions and 3 deletions
|
@ -9,7 +9,6 @@ export default function arrayBufferToStream(arrayBuffer: ArrayBuffer, offset = 0
|
||||||
|
|
||||||
let position = offset;
|
let position = offset;
|
||||||
const outStream = new stream.Readable({
|
const outStream = new stream.Readable({
|
||||||
encoding: 'binary',
|
|
||||||
read(size) {
|
read(size) {
|
||||||
const chunkSize = Math.min(size || BUFFER_SIZE, arrayBuffer.byteLength - position); //TODO: we can probably remove BUFFER_SIZE
|
const chunkSize = Math.min(size || BUFFER_SIZE, arrayBuffer.byteLength - position); //TODO: we can probably remove BUFFER_SIZE
|
||||||
let needMoreData: boolean;
|
let needMoreData: boolean;
|
||||||
|
|
|
@ -5,7 +5,6 @@ export default function decryptStream(inputStream: stream.Readable, decryptionKe
|
||||||
let skippedRandomHeader = false;
|
let skippedRandomHeader = false;
|
||||||
|
|
||||||
const outStream = new stream.Readable({
|
const outStream = new stream.Readable({
|
||||||
encoding: 'binary',
|
|
||||||
read(size) {
|
read(size) {
|
||||||
//There are 12 random bytes at the beginning, we need to use them to initialize the decryption keys, but we can ignore the decrypted bytes.
|
//There are 12 random bytes at the beginning, we need to use them to initialize the decryption keys, but we can ignore the decrypted bytes.
|
||||||
if (!skippedRandomHeader) {
|
if (!skippedRandomHeader) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ export default function streamSetMaxLength(inputStream: stream.Readable, maxLeng
|
||||||
let remaining = maxLength;
|
let remaining = maxLength;
|
||||||
|
|
||||||
const outStream = new stream.Readable({
|
const outStream = new stream.Readable({
|
||||||
encoding: 'binary',
|
|
||||||
read(size) {
|
read(size) {
|
||||||
//If no size is provided, just pass through all remaining bytes
|
//If no size is provided, just pass through all remaining bytes
|
||||||
if (size === undefined) {
|
if (size === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue