Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@php-wasm/stream-compression

Package Overview
Dependencies
Maintainers
4
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@php-wasm/stream-compression - npm Package Compare versions

Comparing version 0.9.19 to 0.9.20

148

index.d.ts

@@ -1,143 +0,5 @@

// Generated by dts-bundle-generator v7.2.0
/**
* Collects the contents of the entire stream into a single Uint8Array.
*
* @param stream The stream to collect.
* @param bytes Optional. The number of bytes to read from the stream.
* @returns The string contents of the stream.
*/
export declare function collectBytes(stream: ReadableStream<Uint8Array>, bytes?: number): Promise<Uint8Array>;
/**
* Collects the contents of the entire stream into a single File object.
*
* @param stream The stream to collect.
* @param fileName The name of the file
* @returns The string contents of the stream.
*/
export declare function collectFile(fileName: string, stream: ReadableStream<Uint8Array>): Promise<File>;
export type IterableReadableStream<R> = ReadableStream<R> & AsyncIterable<R>;
/**
* Converts an iterator or iterable to a stream.
*
* @param iteratorOrIterable The iterator or iterable to convert.
* @returns A stream that will yield the values from the iterator or iterable.
*/
export declare function iteratorToStream<T>(iteratorOrIterable: AsyncIterator<T> | Iterator<T> | AsyncIterable<T> | Iterable<T>): IterableReadableStream<T>;
/**
* Represents a file that is streamed and not fully
* loaded into memory.
*/
export declare class StreamedFile extends File {
private readableStream;
/**
* Creates a new StreamedFile instance.
*
* @param readableStream The readable stream containing the file data.
* @param name The name of the file.
* @param type The MIME type of the file.
*/
constructor(readableStream: ReadableStream<Uint8Array>, name: string, type?: string);
/**
* Overrides the slice() method of the File class.
*
* @returns A Blob representing a portion of the file.
*/
slice(): Blob;
/**
* Returns the readable stream associated with the file.
*
* @returns The readable stream.
*/
stream(): ReadableStream<Uint8Array>;
/**
* Loads the file data into memory and then returns it as a string.
*
* @returns File data as text.
*/
text(): Promise<string>;
/**
* Loads the file data into memory and then returns it as an ArrayBuffer.
*
* @returns File data as an ArrayBuffer.
*/
arrayBuffer(): Promise<Uint8Array>;
}
declare const SIGNATURE_FILE: 67324752;
declare const SIGNATURE_CENTRAL_DIRECTORY: 33639248;
declare const COMPRESSION_NONE: 0;
declare const COMPRESSION_DEFLATE: 8;
export type CompressionMethod = typeof COMPRESSION_NONE | typeof COMPRESSION_DEFLATE;
/**
* Data of the file entry header encoded in a ".zip" file.
*/
export interface FileHeader {
signature: typeof SIGNATURE_FILE;
version: number;
generalPurpose: number;
compressionMethod: CompressionMethod;
lastModifiedTime: number;
lastModifiedDate: number;
crc: number;
compressedSize: number;
uncompressedSize: number;
path: Uint8Array;
extra: Uint8Array;
}
export interface FileEntry extends FileHeader {
isDirectory: boolean;
bytes: Uint8Array;
}
/**
* Data of the central directory entry encoded in a ".zip" file.
*/
export interface CentralDirectoryEntry {
signature: typeof SIGNATURE_CENTRAL_DIRECTORY;
versionCreated: number;
versionNeeded: number;
generalPurpose: number;
compressionMethod: CompressionMethod;
lastModifiedTime: number;
lastModifiedDate: number;
crc: number;
compressedSize: number;
uncompressedSize: number;
diskNumber: number;
internalAttributes: number;
externalAttributes: number;
firstByteAt: number;
lastByteAt: number;
path: Uint8Array;
extra: Uint8Array;
fileComment: Uint8Array;
isDirectory: boolean;
}
/**
* Unzips a stream of zip file bytes.
*
* @param stream A stream of zip file bytes.
* @param predicate Optional. A function that returns true if the file should be downloaded.
* @returns An iterable stream of File objects.
*/
export declare function decodeZip(stream: ReadableStream<Uint8Array>, predicate?: () => boolean): IterableReadableStream<File>;
/**
* Streams the contents of a remote zip file.
*
* If the zip is large and the predicate is filtering the zip contents,
* only the matching files will be downloaded using the Range header
* (if supported by the server).
*
* @param url The URL of the zip file.
* @param predicate Optional. A function that returns true if the file should be downloaded.
* @returns A stream of zip entries.
*/
export declare function decodeRemoteZip(url: string, predicate?: (dirEntry: CentralDirectoryEntry | FileEntry) => boolean): Promise<IterableReadableStream<FileEntry> | IterableReadableStream<File>>;
/**
* Compresses the given files into a ZIP archive.
*
* @param files - An async or sync iterable of files to be compressed.
* @returns A readable stream of the compressed ZIP archive as Uint8Array chunks.
*/
export declare function encodeZip(files: AsyncIterable<File> | Iterable<File>): ReadableStream<Uint8Array>;
export {};
export { collectBytes } from './utils/collect-bytes';
export { collectFile } from './utils/collect-file';
export { iteratorToStream } from './utils/iterator-to-stream';
export { StreamedFile } from './utils/streamed-file';
export { encodeZip, decodeZip, decodeRemoteZip } from './zip';

8

package.json
{
"name": "@php-wasm/stream-compression",
"version": "0.9.19",
"version": "0.9.20",
"description": "Stream-based compression bindings.",

@@ -32,8 +32,8 @@ "repository": {

"type": "module",
"gitHead": "aafbbcdc4b0644885bd55d0ed67381952f0b16b6",
"gitHead": "f619fcb719128d247bec296b9339aff52101e948",
"dependencies": {
"@php-wasm/node-polyfills": "0.9.19",
"@php-wasm/util": "0.9.19"
"@php-wasm/node-polyfills": "0.9.20",
"@php-wasm/util": "0.9.20"
},
"main": "index.js"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc