-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
149 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ export {parse, stringify} from "https://deno.land/[email protected]/csv/mod.ts"; | |
export {ZipReader, ZipWriter, Uint8ArrayReader, Uint8ArrayWriter} from "https://deno.land/x/[email protected]/index.js"; | ||
|
||
// @deno-types="https://cdn.sheetjs.com/xlsx-0.20.1/package/types/index.d.ts" | ||
export {type WorkBook, type WorkSheet, type CellObject, set_cptable, read as xlsxRead, write as xlsxWrite, utils as xlsxUtil} from "https://cdn.sheetjs.com/xlsx-0.20.1/package/xlsx.mjs"; | ||
export {type WorkBook as RawWorkBook, type WorkSheet as RawWorkSheet, type CellObject as RawWorkCell, set_cptable, read as xlsxRead, write as xlsxWrite, utils as xlsxUtil} from "https://cdn.sheetjs.com/xlsx-0.20.1/package/xlsx.mjs"; | ||
export * as xlsxcp from "https://cdn.sheetjs.com/xlsx-0.20.1/package/dist/cpexcel.full.mjs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
import {streamEncode, streamDecode} from "./stream.ts"; | ||
|
||
const DEFLATE_CODEC = "deflate-raw"; | ||
type CompressCodec = "gzip" | "deflate" | "deflate-raw"; | ||
|
||
const COMPRESS_CODEC = "deflate-raw"; | ||
|
||
/** | ||
* Compress binary with "deflate" format. | ||
* Does not contain header such as "gzip" (RFC1952) or "zlib" (RFC1950). | ||
* Compress binary with DEFLATE format. | ||
* Default codec is DEFLATE with no header (RFC-1951) and name in WebAPI specification is `"deflate-raw"`. | ||
* @example | ||
* ```ts | ||
* const bin = await Deno.readFile("./file"); | ||
* const encode = await deflateEncode(bin); | ||
* const decode = await deflateDecode(encode); | ||
* ``` | ||
*/ | ||
export async function deflateEncode(data:Uint8Array, codec?:string):Promise<Uint8Array>{ | ||
return await streamDecode(streamEncode(data).pipeThrough(new CompressionStream(codec ?? DEFLATE_CODEC))); | ||
export async function deflateEncode(data:Uint8Array, codec?:CompressCodec):Promise<Uint8Array>{ | ||
return await streamDecode(streamEncode(data).pipeThrough(new CompressionStream(codec ?? COMPRESS_CODEC))); | ||
} | ||
|
||
/** | ||
* Decompress "deflate" format binary. | ||
* Cannot decompress such as "gzip" (RFC1952) or "zlib" (RFC1950) that contain header. | ||
* Decompress DEFLATE format binary. | ||
* Default codec is DEFLATE with no header (RFC-1951) and name in WebAPI specification is `"deflate-raw"`. | ||
* @example | ||
* ```ts | ||
* const bin = await Deno.readFile("./file"); | ||
* const encode = await deflateEncode(bin); | ||
* const decode = await deflateDecode(encode); | ||
* ``` | ||
*/ | ||
export async function deflateDecode(data:Uint8Array, codec?:string):Promise<Uint8Array>{ | ||
return await streamDecode(streamEncode(data).pipeThrough(new DecompressionStream(codec ?? DEFLATE_CODEC))); | ||
export async function deflateDecode(data:Uint8Array, codec?:CompressCodec):Promise<Uint8Array>{ | ||
return await streamDecode(streamEncode(data).pipeThrough(new DecompressionStream(codec ?? COMPRESS_CODEC))); | ||
} |
Oops, something went wrong.