@@ -615,6 +615,149 @@ These types are useful for graphics work; applying transforms to canvas
615615drawings, computing layout math, or porting browser code that depends on
616616geometry types.
617617
618+ ## navigator
619+
620+ Deno implements a subset of the
621+ [` navigator` ](https: // developer.mozilla.org/en-US/docs/Web/API/Navigator)
622+ global . The following properties are available:
623+
624+ - ` navigator.userAgent` — always ` "Deno/<version>"`
625+ - ` navigator.platform` — the underlying OS platform (e .g . ` "Linux x86_64"` ,
626+ ` "MacIntel"` , ` "Win32"` ). Added in Deno 2.7 .
627+ - ` navigator.hardwareConcurrency` — number of logical CPU cores
628+
629+ ` ` ` ts
630+ console.log(navigator.userAgent); // "Deno/2.7.0"
631+ console.log(navigator.platform); // e.g. "Linux x86_64", "MacIntel", "Win32"
632+ console.log(navigator.hardwareConcurrency); // e.g. 8
633+ ` ` `
634+
635+ ## Temporal
636+
637+ The [Temporal API ](https: // tc39.es/proposal-temporal/docs/) is a modern
638+ date/ time library that replaces ` Date` for most use cases . It was stabilized in
639+ Deno 2.7 and is available as a global without any flags.
640+
641+ ` ` ` ts
642+ // Current date/time in local timezone
643+ const now = Temporal.Now.plainDateTimeISO();
644+ console.log(now.toString()); // e.g. "2025-03-12T10:30:00"
645+
646+ // Parse a date
647+ const date = Temporal.PlainDate.from("2025-03-12");
648+ console.log(date.month); // 3
649+
650+ // Timezone-aware
651+ const zonedNow = Temporal.Now.zonedDateTimeISO("America/New_York");
652+ console.log(zonedNow.timeZoneId); // "America/New_York"
653+ ` ` `
654+
655+ Prior to Deno 2.7 , Temporal required the ` --unstable-temporal` flag.
656+
657+ ## CompressionStream and DecompressionStream
658+
659+ Deno supports
660+ [` CompressionStream` ](https: // developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
661+ and
662+ [` DecompressionStream` ](https: // developer.mozilla.org/en-US/docs/Web/API/DecompressionStream)
663+ for streaming compression and decompression.
664+
665+ ### Supported formats
666+
667+ | Format | String | Notes |
668+ | ---------- - | -------------- - | ------------------ |
669+ | gzip | ` "gzip"` | RFC 1952 |
670+ | deflate | ` "deflate"` | zlib (RFC 1950 ) |
671+ | deflate- raw | ` "deflate-raw"` | raw DEFLATE (1951 ) |
672+ | Brotli | ` "brotli"` | Added in Deno 2.7 |
673+
674+ ` ` ` ts
675+ // Compress with Brotli
676+ const input = new TextEncoder().encode("Hello, Deno!");
677+ const cs = new CompressionStream("brotli");
678+ const writer = cs.writable.getWriter();
679+ writer.write(input);
680+ writer.close();
681+ const compressed = await new Response(cs.readable).arrayBuffer();
682+
683+ // Decompress
684+ const ds = new DecompressionStream("brotli");
685+ const writer2 = ds.writable.getWriter();
686+ writer2.write(new Uint8Array(compressed));
687+ writer2.close();
688+ const result = await new Response(ds.readable).text();
689+ console.log(result); // "Hello, Deno!"
690+ ` ` `
691+
692+ ## Web Crypto
693+
694+ Deno supports the
695+ [Web Crypto API ](https: // developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
696+ via ` crypto.subtle` . Starting with Deno 2.7 , SHA - 3 hash algorithms are
697+ supported:
698+
699+ - ` SHA3-256`
700+ - ` SHA3-384`
701+ - ` SHA3-512`
702+
703+ ` ` ` ts
704+ const data = new TextEncoder().encode("Hello, Deno!");
705+ const hash = await crypto.subtle.digest("SHA3-256", data);
706+ console.log(new Uint8Array(hash));
707+ ` ` `
708+
709+ ## createImageBitmap
710+
711+ Deno supports
712+ [` createImageBitmap()` ](https: // developer.mozilla.org/en-US/docs/Web/API/createImageBitmap)
713+ for decoding images into ` ImageBitmap` objects that can be used with
714+ [` OffscreenCanvas` ](#offscreencanvas).
715+
716+ ### Supported input formats
717+
718+ | Format | Notes |
719+ | ------ | ---------------- - |
720+ | PNG | |
721+ | JPEG | |
722+ | BMP | |
723+ | GIF | Added in Deno 2.7 |
724+ | WebP | Added in Deno 2.7 |
725+
726+ ` ` ` ts
727+ const data = await Deno.readFile("./image.gif");
728+ const bitmap = await createImageBitmap(new Blob([data]));
729+ console.log(bitmap.width, bitmap.height);
730+ ` ` `
731+
732+ ## File locking
733+
734+ [` Deno.FsFile` ](/ api/ deno/ ~ / Deno .FsFile ) supports advisory file locking to
735+ coordinate access between processes:
736+
737+ - [` lock(exclusive?)` ](/ api/ deno/ ~ / Deno .FsFile .prototype .lock ) — acquires a
738+ lock . Shared (read) by default; pass ` true` for exclusive (write). Blocks if
739+ an incompatible lock is held.
740+ - [` lockSync(exclusive?)` ](/ api/ deno/ ~ / Deno .FsFile .prototype .lockSync ) —
741+ synchronous variant of ` lock()` .
742+ - [` tryLock(exclusive?)` ](/ api/ deno/ ~ / Deno .FsFile .prototype .tryLock ) —
743+ non- blocking . Returns ` true` if the lock was acquired, ` false` otherwise.
744+ Added in Deno 2.7 .
745+ - [` tryLockSync(exclusive?)` ](/ api/ deno/ ~ / Deno .FsFile .prototype .tryLockSync ) —
746+ synchronous variant of ` tryLock()` .
747+
748+ ` ` ` ts
749+ const file = await Deno.open("./data.txt", { read: true, write: true });
750+
751+ const locked = await file.tryLock(true); // exclusive
752+ if (locked) {
753+ await file.write(new TextEncoder().encode("hello"));
754+ await file.unlock();
755+ } else {
756+ console.log("File is locked by another process, skipping.");
757+ }
758+ file.close();
759+ ` ` `
760+
618761## Deviations of other APIs from spec
619762
620763### Cache API
0 commit comments