Buckets:
| import { AsyncLocalStorage } from "node:async_hooks" | |
| export namespace Context { | |
| export class NotFound extends Error {} | |
| export function create<T>() { | |
| const storage = new AsyncLocalStorage<T>() | |
| return { | |
| use() { | |
| const result = storage.getStore() | |
| if (!result) { | |
| throw new NotFound() | |
| } | |
| return result | |
| }, | |
| provide<R>(value: T, fn: () => R) { | |
| return storage.run(value, fn) | |
| }, | |
| } | |
| } | |
| } | |
Xet Storage Details
- Size:
- 467 Bytes
- Xet hash:
- bc21718ed8c6ee5dbdaf19d7cfb4881a8a4501ec80509b1f05b54d2c7ca092d2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.