Spec-Zone.ru › Nushell

open for filesystem

Load a file into a cell, converting to table if possible (avoid by appending '--raw').

Signature

> open {flags} ...rest

Flags

  • --raw, -r: Open file as raw binary.

Parameters

  • ...rest: The file(s) to open.

Input/output types:

input output
nothing any
string any
any any

Examples

Open a file, with structure (based on file extension or SQLite database header).

> open myfile.json

Open a file, as raw bytes.

> open myfile.json --raw

Open a file, using the input to get filename.

> 'myfile.txt' | open

Open a file, and decode it by the specified encoding.

> open myfile.txt --raw | decode utf-8

Create a custom from parser to open newline-delimited JSON files with open.

> def "from ndjson" [] { from json -o }; open myfile.ndjson

Show the extensions for which the open command will automatically parse.

> scope commands
    | where name starts-with "from "
    | insert extension { get name | str replace -r "^from " "" | $"*.($in)" }
    | select extension name
    | rename extension command

Notes

Support to automatically parse files with an extension .xyz can be provided by a from xyz command in scope.

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/open.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API