rahad-media-downloader 2.1.12 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/typescript/5.4/node_modules/.package-lock.json +185 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/@types/domhandler/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/domhandler/README.md +92 -0
- package/.cache/typescript/5.4/node_modules/@types/domhandler/index.d.ts +73 -0
- package/.cache/typescript/5.4/node_modules/@types/domhandler/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/@types/domutils/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/domutils/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/domutils/index.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/domutils/package.json +27 -0
- package/.cache/typescript/5.4/node_modules/@types/htmlparser2/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/htmlparser2/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/htmlparser2/index.d.ts +120 -0
- package/.cache/typescript/5.4/node_modules/@types/htmlparser2/package.json +45 -0
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1542 -0
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4522 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +545 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +473 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +853 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +884 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +411 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1889 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +996 -0
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +645 -0
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1747 -0
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1470 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +944 -0
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2276 -0
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +764 -0
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +921 -0
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/externals.d.ts +32 -0
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/index.d.ts +238 -0
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/package.json +83 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/index.d.ts +79 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/package.json +65 -0
- package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md +350 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md.bak +350 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/index.d.ts +51 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/form_data.js +483 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.4/node_modules/domelementtype/LICENSE +11 -0
- package/.cache/typescript/5.4/node_modules/domelementtype/index.js +15 -0
- package/.cache/typescript/5.4/node_modules/domelementtype/package.json +16 -0
- package/.cache/typescript/5.4/node_modules/domelementtype/readme.md +1 -0
- package/.cache/typescript/5.4/node_modules/domhandler/.travis.yml +6 -0
- package/.cache/typescript/5.4/node_modules/domhandler/LICENSE +11 -0
- package/.cache/typescript/5.4/node_modules/domhandler/index.js +217 -0
- package/.cache/typescript/5.4/node_modules/domhandler/lib/element.js +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/lib/node.js +44 -0
- package/.cache/typescript/5.4/node_modules/domhandler/package.json +41 -0
- package/.cache/typescript/5.4/node_modules/domhandler/readme.md +116 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/01-basic.json +57 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/12-text_only.json +11 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/23-dom-lvl1.json +131 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/24-with-start-indices.json +85 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/cases/25-with-end-indices.json +86 -0
- package/.cache/typescript/5.4/node_modules/domhandler/test/tests.js +60 -0
- package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +358 -0
- package/.cache/typescript/5.4/node_modules/form-data/Readme.md +358 -0
- package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +62 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +501 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.4/package-lock.json +197 -0
- package/.cache/typescript/5.4/package.json +1 -0
- package/README.md +61 -2
- package/index.js +1 -1
- package/package.json +11 -2
- package/.cache/replit/modules/nodejs-20:v36-20240502-f4453db.res +0 -1
- package/.cache/replit/modules/replit:v9-20240429-0325cbb.res +0 -1
@@ -0,0 +1,181 @@
|
|
1
|
+
/**
|
2
|
+
* **The `node:wasi` module does not currently provide the**
|
3
|
+
* **comprehensive file system security properties provided by some WASI runtimes.**
|
4
|
+
* **Full support for secure file system sandboxing may or may not be implemented in**
|
5
|
+
* **future. In the mean time, do not rely on it to run untrusted code.**
|
6
|
+
*
|
7
|
+
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives WebAssembly applications access to the underlying
|
8
|
+
* operating system via a collection of POSIX-like functions.
|
9
|
+
*
|
10
|
+
* ```js
|
11
|
+
* import { readFile } from 'node:fs/promises';
|
12
|
+
* import { WASI } from 'wasi';
|
13
|
+
* import { argv, env } from 'node:process';
|
14
|
+
*
|
15
|
+
* const wasi = new WASI({
|
16
|
+
* version: 'preview1',
|
17
|
+
* args: argv,
|
18
|
+
* env,
|
19
|
+
* preopens: {
|
20
|
+
* '/local': '/some/real/path/that/wasm/can/access',
|
21
|
+
* },
|
22
|
+
* });
|
23
|
+
*
|
24
|
+
* const wasm = await WebAssembly.compile(
|
25
|
+
* await readFile(new URL('./demo.wasm', import.meta.url)),
|
26
|
+
* );
|
27
|
+
* const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject());
|
28
|
+
*
|
29
|
+
* wasi.start(instance);
|
30
|
+
* ```
|
31
|
+
*
|
32
|
+
* To run the above example, create a new WebAssembly text format file named `demo.wat`:
|
33
|
+
*
|
34
|
+
* ```text
|
35
|
+
* (module
|
36
|
+
* ;; Import the required fd_write WASI function which will write the given io vectors to stdout
|
37
|
+
* ;; The function signature for fd_write is:
|
38
|
+
* ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
|
39
|
+
* (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
|
40
|
+
*
|
41
|
+
* (memory 1)
|
42
|
+
* (export "memory" (memory 0))
|
43
|
+
*
|
44
|
+
* ;; Write 'hello world\n' to memory at an offset of 8 bytes
|
45
|
+
* ;; Note the trailing newline which is required for the text to appear
|
46
|
+
* (data (i32.const 8) "hello world\n")
|
47
|
+
*
|
48
|
+
* (func $main (export "_start")
|
49
|
+
* ;; Creating a new io vector within linear memory
|
50
|
+
* (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
|
51
|
+
* (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
|
52
|
+
*
|
53
|
+
* (call $fd_write
|
54
|
+
* (i32.const 1) ;; file_descriptor - 1 for stdout
|
55
|
+
* (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
|
56
|
+
* (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
|
57
|
+
* (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
|
58
|
+
* )
|
59
|
+
* drop ;; Discard the number of bytes written from the top of the stack
|
60
|
+
* )
|
61
|
+
* )
|
62
|
+
* ```
|
63
|
+
*
|
64
|
+
* Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
|
65
|
+
*
|
66
|
+
* ```bash
|
67
|
+
* wat2wasm demo.wat
|
68
|
+
* ```
|
69
|
+
* @experimental
|
70
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/wasi.js)
|
71
|
+
*/
|
72
|
+
declare module "wasi" {
|
73
|
+
interface WASIOptions {
|
74
|
+
/**
|
75
|
+
* An array of strings that the WebAssembly application will
|
76
|
+
* see as command line arguments. The first argument is the virtual path to the
|
77
|
+
* WASI command itself.
|
78
|
+
* @default []
|
79
|
+
*/
|
80
|
+
args?: string[] | undefined;
|
81
|
+
/**
|
82
|
+
* An object similar to `process.env` that the WebAssembly
|
83
|
+
* application will see as its environment.
|
84
|
+
* @default {}
|
85
|
+
*/
|
86
|
+
env?: object | undefined;
|
87
|
+
/**
|
88
|
+
* This object represents the WebAssembly application's
|
89
|
+
* sandbox directory structure. The string keys of `preopens` are treated as
|
90
|
+
* directories within the sandbox. The corresponding values in `preopens` are
|
91
|
+
* the real paths to those directories on the host machine.
|
92
|
+
*/
|
93
|
+
preopens?: NodeJS.Dict<string> | undefined;
|
94
|
+
/**
|
95
|
+
* By default, when WASI applications call `__wasi_proc_exit()`
|
96
|
+
* `wasi.start()` will return with the exit code specified rather than terminatng the process.
|
97
|
+
* Setting this option to `false` will cause the Node.js process to exit with
|
98
|
+
* the specified exit code instead.
|
99
|
+
* @default true
|
100
|
+
*/
|
101
|
+
returnOnExit?: boolean | undefined;
|
102
|
+
/**
|
103
|
+
* The file descriptor used as standard input in the WebAssembly application.
|
104
|
+
* @default 0
|
105
|
+
*/
|
106
|
+
stdin?: number | undefined;
|
107
|
+
/**
|
108
|
+
* The file descriptor used as standard output in the WebAssembly application.
|
109
|
+
* @default 1
|
110
|
+
*/
|
111
|
+
stdout?: number | undefined;
|
112
|
+
/**
|
113
|
+
* The file descriptor used as standard error in the WebAssembly application.
|
114
|
+
* @default 2
|
115
|
+
*/
|
116
|
+
stderr?: number | undefined;
|
117
|
+
/**
|
118
|
+
* The version of WASI requested.
|
119
|
+
* Currently the only supported versions are `'unstable'` and `'preview1'`. This option is mandatory.
|
120
|
+
* @since v19.8.0
|
121
|
+
*/
|
122
|
+
version: "unstable" | "preview1";
|
123
|
+
}
|
124
|
+
/**
|
125
|
+
* The `WASI` class provides the WASI system call API and additional convenience
|
126
|
+
* methods for working with WASI-based applications. Each `WASI` instance
|
127
|
+
* represents a distinct environment.
|
128
|
+
* @since v13.3.0, v12.16.0
|
129
|
+
*/
|
130
|
+
class WASI {
|
131
|
+
constructor(options?: WASIOptions);
|
132
|
+
/**
|
133
|
+
* Return an import object that can be passed to `WebAssembly.instantiate()` if no other WASM imports are needed beyond those provided by WASI.
|
134
|
+
*
|
135
|
+
* If version `unstable` was passed into the constructor it will return:
|
136
|
+
*
|
137
|
+
* ```js
|
138
|
+
* { wasi_unstable: wasi.wasiImport }
|
139
|
+
* ```
|
140
|
+
*
|
141
|
+
* If version `preview1` was passed into the constructor or no version was specified it will return:
|
142
|
+
*
|
143
|
+
* ```js
|
144
|
+
* { wasi_snapshot_preview1: wasi.wasiImport }
|
145
|
+
* ```
|
146
|
+
* @since v19.8.0
|
147
|
+
*/
|
148
|
+
getImportObject(): object;
|
149
|
+
/**
|
150
|
+
* Attempt to begin execution of `instance` as a WASI command by invoking its `_start()` export. If `instance` does not contain a `_start()` export, or if `instance` contains an `_initialize()`
|
151
|
+
* export, then an exception is thrown.
|
152
|
+
*
|
153
|
+
* `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`. If
|
154
|
+
* `instance` does not have a `memory` export an exception is thrown.
|
155
|
+
*
|
156
|
+
* If `start()` is called more than once, an exception is thrown.
|
157
|
+
* @since v13.3.0, v12.16.0
|
158
|
+
*/
|
159
|
+
start(instance: object): number; // TODO: avoid DOM dependency until WASM moved to own lib.
|
160
|
+
/**
|
161
|
+
* Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present. If `instance` contains a `_start()` export, then an exception is thrown.
|
162
|
+
*
|
163
|
+
* `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`.
|
164
|
+
* If `instance` does not have a `memory` export an exception is thrown.
|
165
|
+
*
|
166
|
+
* If `initialize()` is called more than once, an exception is thrown.
|
167
|
+
* @since v14.6.0, v12.19.0
|
168
|
+
*/
|
169
|
+
initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
|
170
|
+
/**
|
171
|
+
* `wasiImport` is an object that implements the WASI system call API. This object
|
172
|
+
* should be passed as the `wasi_snapshot_preview1` import during the instantiation
|
173
|
+
* of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
|
174
|
+
* @since v13.3.0, v12.16.0
|
175
|
+
*/
|
176
|
+
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
|
177
|
+
}
|
178
|
+
}
|
179
|
+
declare module "node:wasi" {
|
180
|
+
export * from "wasi";
|
181
|
+
}
|