Giter Site home page Giter Site logo

Comments (7)

fdncred avatar fdncred commented on June 8, 2024 1

I'm moving this to nushell since it's not really about our documentation.

from nushell.

fdncred avatar fdncred commented on June 8, 2024

You mean like 0x[deadbeef]? We also support 0b[101010] and 0o[1234]

from nushell.

YizhePKU avatar YizhePKU commented on June 8, 2024

@fdncred OK, I think my choice of example is confusing. I mean something like b"Hello world" should be parsed as a 11-bytes binary blob.

This is different from 0x[deadbeef], which is a 4-bytes binary blob.

from nushell.

fdncred avatar fdncred commented on June 8, 2024

in your "patching" example, bytes replace wants to use 0x[123] format for matching/replacing bytes.

you can also do "hello world" | into binary to get the binary data.

from nushell.

YizhePKU avatar YizhePKU commented on June 8, 2024

you can also do "hello world" | into binary to get the binary data.

Exactly. I'm just suggesting a syntax shortcut for this. Without this syntax, I'll have to write:

open ./a.out | bytes replace --all ('deadbeef' | into binary) ('livebeef' | into binary)

This is the same syntax used by Python and Rust to specify bytes literals.

from nushell.

YizhePKU avatar YizhePKU commented on June 8, 2024

By the way, does into binary make any guarantee about text encoding? I don't see this mentioned in the docs.

from nushell.

fdncred avatar fdncred commented on June 8, 2024

I'm not sure. You'd have to look at the code. https://github.com/nushell/nushell/blob/main/crates/nu-command/src/conversions/into/binary.rs

from nushell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.