deno vs ts-node : what's the difference

后端 未结 3 1370
时光取名叫无心
时光取名叫无心 2020-12-23 16:49

I\'m working on a relative large typescript project, I\'m using ts-node to run node testing and examples. As far as I understand, ts-node will comp

3条回答
  •  醉酒成梦
    2020-12-23 16:52

    I think @rsp has already posted detailed info related to Deno.

    I want to put some key points here so that others can easily put their eyes on key difference:

    • Language- Deno is based on RUST language - Rust is a multi-paradigm programming language focused on performance and safety, especially safe concurrency. Rust is syntactically similar to C++, but provides memory safety without using garbage collection

    • Runtime- Deno also relies on the V8 engine.

    • Security — A common criticism of Node.js is that once a node app is running, it can easily access the file system or the network etc. While Deno asks user permission to allow use of resuorces like net, file system etc.

    • NPM?- Deno does not rely on NPM at all, instead of this we import our libraries via the URL.

    Example:

    > import { serve } from "https://deno.land/std/http/server.ts";
    

    All the library we want to use is downloaded first then cached it.

    • Window Object- Good news is that now we can use the Window Object in Deno which is not available in Node.js. Window Object has much rich APIs which can help a lot in Deno for development.
    • Import- Deno use ES6 import in inject the module in files.
    • Typescript- Deno fully supports typescript.

提交回复
热议问题