Code Monkey home page Code Monkey logo

Comments (8)

tw4452852 avatar tw4452852 commented on July 17, 2024 1

Really hope jo could add an option to support reading the raw content of a file as a string.

from jo.

jpmens avatar jpmens commented on July 17, 2024 1

I'm not hugely in favor of a switch to toggle that behaviour. Would a separate character make sense? <filename, reminischent of shell input.

BTW, if we do implement this, the underlying JSON routines will not handle binary zero \00, so I'm not sure how useful this would be.

from jo.

jpmens avatar jpmens commented on July 17, 2024

It made sense to me/us to have that stripped.

Why would you not want it stripped?

from jo.

jpmens avatar jpmens commented on July 17, 2024

We should probably amend the description in the man page.

from jo.

tw4452852 avatar tw4452852 commented on July 17, 2024

But I want to make a json with the exact content of a file as it-is. Could I archieve this with jo? Maybe we could add a option (like -raw)?

from jo.

jpmens avatar jpmens commented on July 17, 2024

The only solution which occurs to me right now is to transport with base64 and then decode on the receiving end:

$ echo hello > test.txt
$ jo 'test=%test.txt'
{"test":"aGVsbG8K"}
$ echo aGVsbG8K | base64 -d
hello
$ echo aGVsbG8K | base64 -d | od -cb
0000000    h   e   l   l   o  \n
          150 145 154 154 157 012
0000006

from jo.

isotopp avatar isotopp commented on July 17, 2024

It made sense to me/us to have that stripped.

Why would you not want it stripped?

It would invalidate any checksum or signature on the content of that file.

from jo.

gromgit avatar gromgit commented on July 17, 2024

Since trimming the output has been the default operation for years with no complaints until now, it might not be desirable to unilaterally switch to verbatim inclusion mode by default.

I guess we could add a -l (for literal) switch, and document current behavior.

from jo.

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.