@php-wasm/stream-compression 0.9.19 → 0.9.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +5 -143
  2. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,143 +1,5 @@
1
- // Generated by dts-bundle-generator v7.2.0
2
-
3
- /**
4
- * Collects the contents of the entire stream into a single Uint8Array.
5
- *
6
- * @param stream The stream to collect.
7
- * @param bytes Optional. The number of bytes to read from the stream.
8
- * @returns The string contents of the stream.
9
- */
10
- export declare function collectBytes(stream: ReadableStream<Uint8Array>, bytes?: number): Promise<Uint8Array>;
11
- /**
12
- * Collects the contents of the entire stream into a single File object.
13
- *
14
- * @param stream The stream to collect.
15
- * @param fileName The name of the file
16
- * @returns The string contents of the stream.
17
- */
18
- export declare function collectFile(fileName: string, stream: ReadableStream<Uint8Array>): Promise<File>;
19
- export type IterableReadableStream<R> = ReadableStream<R> & AsyncIterable<R>;
20
- /**
21
- * Converts an iterator or iterable to a stream.
22
- *
23
- * @param iteratorOrIterable The iterator or iterable to convert.
24
- * @returns A stream that will yield the values from the iterator or iterable.
25
- */
26
- export declare function iteratorToStream<T>(iteratorOrIterable: AsyncIterator<T> | Iterator<T> | AsyncIterable<T> | Iterable<T>): IterableReadableStream<T>;
27
- /**
28
- * Represents a file that is streamed and not fully
29
- * loaded into memory.
30
- */
31
- export declare class StreamedFile extends File {
32
- private readableStream;
33
- /**
34
- * Creates a new StreamedFile instance.
35
- *
36
- * @param readableStream The readable stream containing the file data.
37
- * @param name The name of the file.
38
- * @param type The MIME type of the file.
39
- */
40
- constructor(readableStream: ReadableStream<Uint8Array>, name: string, type?: string);
41
- /**
42
- * Overrides the slice() method of the File class.
43
- *
44
- * @returns A Blob representing a portion of the file.
45
- */
46
- slice(): Blob;
47
- /**
48
- * Returns the readable stream associated with the file.
49
- *
50
- * @returns The readable stream.
51
- */
52
- stream(): ReadableStream<Uint8Array>;
53
- /**
54
- * Loads the file data into memory and then returns it as a string.
55
- *
56
- * @returns File data as text.
57
- */
58
- text(): Promise<string>;
59
- /**
60
- * Loads the file data into memory and then returns it as an ArrayBuffer.
61
- *
62
- * @returns File data as an ArrayBuffer.
63
- */
64
- arrayBuffer(): Promise<Uint8Array>;
65
- }
66
- declare const SIGNATURE_FILE: 67324752;
67
- declare const SIGNATURE_CENTRAL_DIRECTORY: 33639248;
68
- declare const COMPRESSION_NONE: 0;
69
- declare const COMPRESSION_DEFLATE: 8;
70
- export type CompressionMethod = typeof COMPRESSION_NONE | typeof COMPRESSION_DEFLATE;
71
- /**
72
- * Data of the file entry header encoded in a ".zip" file.
73
- */
74
- export interface FileHeader {
75
- signature: typeof SIGNATURE_FILE;
76
- version: number;
77
- generalPurpose: number;
78
- compressionMethod: CompressionMethod;
79
- lastModifiedTime: number;
80
- lastModifiedDate: number;
81
- crc: number;
82
- compressedSize: number;
83
- uncompressedSize: number;
84
- path: Uint8Array;
85
- extra: Uint8Array;
86
- }
87
- export interface FileEntry extends FileHeader {
88
- isDirectory: boolean;
89
- bytes: Uint8Array;
90
- }
91
- /**
92
- * Data of the central directory entry encoded in a ".zip" file.
93
- */
94
- export interface CentralDirectoryEntry {
95
- signature: typeof SIGNATURE_CENTRAL_DIRECTORY;
96
- versionCreated: number;
97
- versionNeeded: number;
98
- generalPurpose: number;
99
- compressionMethod: CompressionMethod;
100
- lastModifiedTime: number;
101
- lastModifiedDate: number;
102
- crc: number;
103
- compressedSize: number;
104
- uncompressedSize: number;
105
- diskNumber: number;
106
- internalAttributes: number;
107
- externalAttributes: number;
108
- firstByteAt: number;
109
- lastByteAt: number;
110
- path: Uint8Array;
111
- extra: Uint8Array;
112
- fileComment: Uint8Array;
113
- isDirectory: boolean;
114
- }
115
- /**
116
- * Unzips a stream of zip file bytes.
117
- *
118
- * @param stream A stream of zip file bytes.
119
- * @param predicate Optional. A function that returns true if the file should be downloaded.
120
- * @returns An iterable stream of File objects.
121
- */
122
- export declare function decodeZip(stream: ReadableStream<Uint8Array>, predicate?: () => boolean): IterableReadableStream<File>;
123
- /**
124
- * Streams the contents of a remote zip file.
125
- *
126
- * If the zip is large and the predicate is filtering the zip contents,
127
- * only the matching files will be downloaded using the Range header
128
- * (if supported by the server).
129
- *
130
- * @param url The URL of the zip file.
131
- * @param predicate Optional. A function that returns true if the file should be downloaded.
132
- * @returns A stream of zip entries.
133
- */
134
- export declare function decodeRemoteZip(url: string, predicate?: (dirEntry: CentralDirectoryEntry | FileEntry) => boolean): Promise<IterableReadableStream<FileEntry> | IterableReadableStream<File>>;
135
- /**
136
- * Compresses the given files into a ZIP archive.
137
- *
138
- * @param files - An async or sync iterable of files to be compressed.
139
- * @returns A readable stream of the compressed ZIP archive as Uint8Array chunks.
140
- */
141
- export declare function encodeZip(files: AsyncIterable<File> | Iterable<File>): ReadableStream<Uint8Array>;
142
-
143
- export {};
1
+ export { collectBytes } from './utils/collect-bytes';
2
+ export { collectFile } from './utils/collect-file';
3
+ export { iteratorToStream } from './utils/iterator-to-stream';
4
+ export { StreamedFile } from './utils/streamed-file';
5
+ export { encodeZip, decodeZip, decodeRemoteZip } from './zip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/stream-compression",
3
- "version": "0.9.19",
3
+ "version": "0.9.20",
4
4
  "description": "Stream-based compression bindings.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,10 +29,10 @@
29
29
  },
30
30
  "license": "GPL-2.0-or-later",
31
31
  "type": "module",
32
- "gitHead": "aafbbcdc4b0644885bd55d0ed67381952f0b16b6",
32
+ "gitHead": "f619fcb719128d247bec296b9339aff52101e948",
33
33
  "dependencies": {
34
- "@php-wasm/node-polyfills": "0.9.19",
35
- "@php-wasm/util": "0.9.19"
34
+ "@php-wasm/node-polyfills": "0.9.20",
35
+ "@php-wasm/util": "0.9.20"
36
36
  },
37
37
  "main": "index.js"
38
38
  }