Some key features of Deno include:
- Security: Deno emphasizes security as a core principle. By default, Deno runs in a secure mode where scripts have restricted access to the file system, network, and other potentially sensitive operations. Access to specific resources or permissions must be explicitly granted to scripts using command-line flags or programmatic permissions.
- Module System: Deno utilizes a module system that conforms to the ECMAScript modules specification. It supports importing modules using standard import statements and can load modules from local files or remote URLs. Deno also provides a built-in package manager called “Deno Registry” for discovering and fetching dependencies.
- Built-in Tools: Deno ships with several built-in tools that simplify common development tasks. It includes a bundled TypeScript compiler, a file watcher for automatic reloads, and a built-in test runner for executing unit tests. These tools enhance developer productivity by eliminating the need for external dependencies or configuration.
- Standard Library: Deno includes a standard library with a set of utility modules for common tasks such as file I/O, HTTP requests, and cryptography. The standard library aims to provide a consistent and reliable set of modules that developers can rely on without external dependencies.
deno Command Examples
# deno run /path/to/file.ts
2. Start a REPL (interactive shell):
3. Run a file with network access enabled:
# deno run --allow-net /path/to/file.ts
4. Run a file from a URL:
# deno run https://deno.land/std/examples/welcome.ts
5. Install an executable script from a URL:
# deno install https://deno.land/std/examples/colors.ts