我正在尝试对库fetch-readystream(https://github.com/jonnyreeves/fetch-readystream)进行轮询。我已经添加了polyfills,并且大多数事情都能正常工作,但是我仍然收到有关TextEncoder的错误ERROR ReferenceError: 'TextEncoder' is undefined
我添加了必需的pollyfills:web-streams-polyfill,text-encoding和babel-polyfill。我尝试了这些polyfill的其他等效方法,但遇到了同样的问题。
我polyfills.ts所需要的IE进口,我注释掉后的文件。
import 'web-streams-polyfill'; // Run `npm install --save web-streams-polyfill`.
import 'text-encoding'; // Run `npm install --save text-encoding`.
import 'babel-polyfill'; // Run `npm install --save babel-polyfill`.
Run Code Online (Sandbox Code Playgroud)
我也尝试将脚本添加到 index.html
<script src="node_modules/text-encoding/lib/encoding-indexes.js"></script>
<script src="node_modules/text-encoding/lib/encoding.js"></script>
Run Code Online (Sandbox Code Playgroud)
我不希望有任何错误,但是我得到了:
ERROR ReferenceError: 'TextEncoder' is undefined
"ERROR"
{
[functions]: ,
__proto__: { },
description: "'TextEncoder' is undefined",
message: "'TextEncoder' is undefined",
name: "ReferenceError",
number: -2146823279,
stack: "ReferenceError: 'TextEncoder' is undefined
at responseParserFactory (http://localhost:4200/vendor.js:139703:3)
at xhrTransport (http://localhost:4200/vendor.js:139960:1)
at fetchStream …Run Code Online (Sandbox Code Playgroud) 我正在构建一个解析 JSON 模板的应用程序,然后用新数据替换对象的值。我的问题是在 JSON 中表示空数据的标准方法是什么?
这就是我现在处理的方式:
这样对吗?
我正在尝试使用标准 deno fs 模块,但编译器抱怨没有--unstable标志。
import { writeJson, readJson } from "https://deno.land/std/fs/mod.ts";
const json = await readJson("input.txt");
console.log(`JSON: ${JSON.stringify(json)}`);
await writeJson("input.txt", json);
Run Code Online (Sandbox Code Playgroud)
我的 deno 版本:
deno 1.0.0-rc2
v8 8.4.300
typescript 3.8.3
Run Code Online (Sandbox Code Playgroud)
我总是遇到相同的错误。它们似乎与缺少模块有关,但我不确定可能缺少什么。
? deno-api denoa filetest.ts
Compile file:///home/astone/source/deno-api/filetest.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:90:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:101:10
TS2339 [ERROR]: Property 'symlink' does …Run Code Online (Sandbox Code Playgroud)