dax
概要
インストール
shell$ deno add jsr:@david/dax
typescriptimport $ from "@david/dax"
ロギング
デフォルトでは標準エラーにログが出力されるようです ( $.setInfoLogger
や $.setWarnLogger
などのAPIでカスタマイズ可能)
typescript// 最初のワードが強調表示されます
$.logStep("Downloading files...");
$.logError("Failed to download files");
ヘルパー
ファイルの存在を確認
typescriptawait $.exists("./some-file.txt");
HTTPリクエストを送信
typescriptawait $.request("https://dl.deno.land/canary-latest.txt").text();
Path
$.path
により Path
オブジェクトが返却されます
typescriptconst tmpDir = $.path(new URL("../tmp", import.meta.url));
// ファイルシステム関連の操作
await tmpDir.ensureDir();
await tmpDir.exists(); // => true
tmpDir.toString(); // => string
// コマンドの引数として渡すこともできます
await $`cat ${tmpDir}`;
shell$ deno repl
> import $ from "@david/dax"
> await $`cat ${$.path("./mod.ts")}`
その他
.wasmファイルの保存場所
リンク
関連パッケージ
関連ページ