The Deno Standard Library
Go to file
Doctor 9298ea503f
feat(archive): UntarStream and TarStream (#4548)
* refactor(archive): An implementation of Tar as streams

* fmt(archive): Ran `deno fmt`

* fix(archive): fixed JSDoc examples in tar_streams.ts

* fix(archive): fixed JSDoc examples so `deno task test` doesn't complain

* fix(archive): lint license error

* fix(archive): lint error files not exported

* set(archive): Set current time as mtime for default

* resolve(archive): resolves comments made

* add(archive): `{ mode: 'byob' }` support for TarStream

* add(archive): `{ mode: 'byob' }` support for UnTarStream

* adjust(archive): The logical flow of a few if statements

* tests(archive): Updated Tests for Un/TarStream

* fix(archive): TarStream mtime wasn't an octal

* fix(archive): TarStream tests

* add(archive): Added parsePathname function

Added parsePathname function abstracting the logic out of TarStream allowing the developer to validate pathnames before providing them to TarStream hoping it doesn't throw an error and require the archive creation to start all over again.

* fix(archive): extra bytes incorrectly appending at the end of files

When the appending file was exactly divisible by 512 bytes, an extra 512 bytes was being appending instead of zero to fill in the gap, causing the next header to be read at the wrong place.

* adjust(archive): to always return the amount of bytes requested

Instead of using enqueue, the leftover bytes are saved for later for the next buffer provided.

* tweaks

* fix

* docs(archive): Link to the spec that they're following

* docs(archive): fix spelling

* add(archive): function validTarSteamOptions

- To make sure, if TarStreamOptions are being provided, that they are in the correct format so as to not create bad tarballs.

* add(archive): more tests

* fix(archive): validTarStreamOptions

* add(archive): tests for validTarStreamOptions

* refactor(archive): code to copy the changes made in the @doctor/tar-stream version

* test(archive): added from @doctor/tar-stream

* chore: nit on anonymous function

* refactor(archive): UnTarStream that fixes unexplainable memory leak

- The second newest test introduced here '... with invalid ending' seems to detect a memory leak due to an invalid tarball. I couldn't figure out why the memory leak was happening but I know this restructure of the code doesn't have that same memory leak.

* chore: fmt

* tests(archive): added remaining tests to cover many lines as possible

* adjust(archive): remove simplify pathname code

* adjust(archive): remove checking for duplicate pathnames in taring process

* adjust(archive): A readable will exist on TarEntry unless string values 1-6

* tests(archive): added more tests for higher coverage

* adjust(archives): TarStream and UnTarStream to implement TransformStream

* docs(archive): moved TarStreamOptions docs into properties.

* adjust(archive): TarStreamFile to take a ReadableSteam instead of an Iterable | AsyncIterable

* adjust(archive): to use FixedChunkStream instead of rolling it's own implementation

* fix(archive): lint error

* adjust(archive): Error types and messages

* adjust(archive): more Error messages / improve tests

* refactor(archive): UnTarStream to return TarStreamChunk instead of TarStreamEntry

* fix(archive): JSDoc example

* adjust(archive): mode, uid, gid options to be provided as numbers instead of strings.

* adjust(archive): TarStream's pathname to be only of type string

* fix(archive): prefix/name to ignore everything past the first NULL

* adjust(archive): `checksum` and `pad` to not be exposed from UnTarStream

* adjust(archive): checksum calculation

* change(archive): `.slice` to `.subarray`

* doc(archive): "octal number" to "octal literal"

* adjust(archive): TarStreamOptions to be optional with defaults

* doc(archive): added more docs for the interfaces

* docs(archive): denoting defaults

* docs(archive): updated for new lint rules

* adjust(archive): Tests to use assertRejects where appropriate & add `validPathname` function

- The `validPathname` is meant to be a nicer exposed function for users of this lib to validate that their pathnames are valid before pipping it through the TarStream, over exposing parsePathname where the user may be confused about what to do with the result.

* adjust(archive): to use `Date.now()` instead of `new Date().getTime()`

Co-authored-by: ud2 <sjx233@qq.com>

* adjust(archive): mode, uid, and gid to be numbers instead of strings when Untaring

* tests(archive): adjust two tests to also validate the contents of the files are valid

* adjust(archive): linkname, uname, and gname to follow the same decoding rules as name and prefix

* rename(archive): UnTarStream to UntarStream

* fix(archive): type that was missed getting updated

* tests(archive): adjust check headers test to validate all header properties instead of just pathnames

* rename(archive): `pathname` properties to `path`

* docs(archive): updated to be more descriptive

* docs(archive): Updated error types

* adjust(archive): `validPath` to `assertValidPath`

* adjust(archive): `validTarStreamOptions` to `assertValidTarStreamOptions`

* revert(archive): UntarStream to produce TarStreamEntry instead of TarStreamChunk

* refactor: remove redundant `void` return types

* docs: cleanup assertion function docs

* docs: correct `TarStream` example

* docs: minor docs cleanups

* refactor: improve error class specificity

* docs: add `@experimental` JSDoc tags

* docs(archive): Updated examples for `assertValidPath` and `assertValidTarStreamOptions```

* fix(archive): problem with tests

- I suspect the problem is that a file that was read by `Deno.readDir` changed size between being read at `Deno.stat` and when `Deno.open` finished pulling it all in.

* update error messages

* update error messages

* fix typos

* refactor: tweak error messages

* refactor: tweaks and add type field

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: ud2 <sjx233@qq.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-09-02 17:43:22 +10:00
_tools chore: fix lint:docs task concurrency (#5756) 2024-08-22 13:10:17 +09:00
.github chore: specify import map path in version_bump workflow (#5826) 2024-08-26 18:03:26 +09:00
.vscode chore: add vscode settings (#4735) 2024-05-15 15:41:32 +09:00
archive feat(archive): UntarStream and TarStream (#4548) 2024-09-02 17:43:22 +10:00
assert refactor(assert,datetime,fmt,io,streams): consistently throw new Error() instead of throw Error() (#5855) 2024-08-29 08:55:24 +10:00
async docs(async): add note about deadline() DOMException name of TimeoutError (#5833) 2024-08-28 15:46:19 +10:00
bytes chore: release 2024.07.09 (#5363) 2024-07-09 15:13:21 +09:00
cache fix(cache/unstable): fix flaky fibonacci test (#5872) 2024-08-30 14:03:58 +10:00
cli chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
collections chore: release 2024.07.19 (#5494) 2024-07-19 20:22:43 +09:00
crypto chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
csv chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
data_structures chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
datetime refactor(assert,datetime,fmt,io,streams): consistently throw new Error() instead of throw Error() (#5855) 2024-08-29 08:55:24 +10:00
dotenv fix(dotenv): handle single-quotes in values in stringify() (#5846) 2024-08-29 10:32:39 +10:00
encoding chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
expect refactor(expect): align error messages in the matchers (#5835) 2024-08-27 14:18:01 +09:00
fmt refactor(assert,datetime,fmt,io,streams): consistently throw new Error() instead of throw Error() (#5855) 2024-08-29 08:55:24 +10:00
front_matter chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
fs chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
html chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
http fix(http): less restrictive arguments for accepts*() functions (#5850) 2024-08-29 10:09:44 +10:00
ini chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
internal chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
io fix(io): don't use Deno.Buffer in examples (#5889) 2024-09-02 08:47:54 +10:00
json chore(json): remove redundant constructor examples (#5513) 2024-07-23 12:06:35 +09:00
jsonc chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
log chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
media_types chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
msgpack fix(msgpack): accept readonly input data in encode() (#5832) 2024-08-27 15:16:03 +10:00
net chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
path feat(path/unstable): support URL in first arg of join() (#5863) 2024-08-30 13:18:12 +09:00
regexp chore(regexp): release regexp@1.0.0 (#5207) 2024-07-12 18:32:36 +10:00
semver chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
streams refactor(assert,datetime,fmt,io,streams): consistently throw new Error() instead of throw Error() (#5855) 2024-08-29 08:55:24 +10:00
testing chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
text chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
toml chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
ulid fix(ulid): fix decode-time export path (#5432) 2024-07-15 12:14:36 +09:00
url chore(url): release url@0.225.0 (#5631) 2024-08-05 17:01:46 +02:00
uuid chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
webgpu chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
yaml refactor(yaml): simplify merge type (#5877) 2024-09-02 15:54:30 +09:00
.editorconfig chore: run test in Node.js (#5258) 2024-07-04 14:36:47 +09:00
.gitattributes Remove std/node, it was merged into Deno itself (#3206) 2023-02-22 10:28:55 -05:00
.gitignore chore: add vscode settings (#4735) 2024-05-15 15:41:32 +09:00
badge.svg chore: switch to JSR-oriented codebase (#4650) 2024-04-29 11:57:30 +09:00
browser-compat.tsconfig.json chore: re-enable browser compat (#5731) 2024-08-20 13:58:45 +10:00
deno.json chore: re-enable browser compat (#5731) 2024-08-20 13:58:45 +10:00
import_map.json chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00
LICENSE chore: update copyright header (#1871) 2022-02-02 23:21:39 +09:00
README.md docs: update badge URL (#5787) 2024-08-26 14:07:06 +09:00
Releases.md chore: release 2024.08.26 (#5824) 2024-08-26 17:33:29 +09:00

Deno Standard Library

JSR @std codecov ci

High-quality APIs for Deno and the web. Use fearlessly.

Important

Newer versions of the Standard Library are now hosted on JSR. Older versions up till 0.224.0 are still available at deno.land/std.

Packages

The following list contains links to the Standard Library's packages and documentation:

Package Latest version
archive JSR
assert JSR
async JSR
bytes JSR
cache JSR
cli JSR
collections JSR
crypto JSR
csv JSR
data_structures JSR
datetime JSR
dotenv JSR
encoding JSR
expect JSR
fmt JSR
front_matter JSR
fs JSR
html JSR
http JSR
ini JSR
io JSR
json JSR
jsonc JSR
log JSR
media_types JSR
msgpack JSR
net JSR
path JSR
regexp JSR
semver JSR
streams JSR
testing JSR
text JSR
toml JSR
ulid JSR
url JSR
uuid JSR
webgpu JSR
yaml JSR

Architecture

Check out the architecture guide here.

Design

Check out the design documentation here.

Contributing

Check out the contributing guidelines here.

Releases

Package versions >=1.0.0 follow Semantic Versioning, and package versions <1.0.0 follow this proposal.

Badge

Note

Previously, this repo hosted the badge SVG file. Now, the badge is retrieved directly from Shields.io.

Built with the Deno Standard Library

<a href="https://jsr.io/@std">
  <img
    width="135"
    height="20"
    src="https://img.shields.io/badge/Built_with_std-blue?logo=deno"
    alt="Built with the Deno Standard Library"
  />
</a>
[![Built with the Deno Standard Library](https://img.shields.io/badge/Built_with_std-blue?logo=deno)](https://jsr.io/@std)

Frequently Asked Questions

Check out the frequently asked questions page here.