Giter VIP home page Giter VIP logo

file2go's Introduction

file2go

┌─┐┬ ┬  ┌─┐   ┌─┐┌─┐
├┤ │ │  ├┤    │ ┬│ │
└  ┴ ┴─┘└─┘ 2 └─┘└─┘
https://github.com/lucasepe/file2go

Convert any file to Go source.

SYNOPSIS:

  file2go [string] [string]

DESCRIPTION:

The file2go utility reads a file from stdin and writes it to stdout,
converting each byte to its hex representation on the fly.

  * if the first [string] is present, it is printed before the data
  * if the second [string] is present, it is printed after the data

This program is used to embed binary or other files into Go source
files, for instance as a []byte.

EXAMPLES:

  date | file2go 'var myDate = []byte {' '}'

will produce:

  var myDate = []byte {
      0x46, 0x72, 0x69, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x33, 0x31,
      0x20, 0x31, 0x37, 0x3a, 0x31, 0x38, 0x3a, 0x34, 0x38, 0x20,
      0x43, 0x45, 0x53, 0x54, 0x20, 0x32, 0x30, 0x32, 0x34, 0x0a
  }





I know very well about the go package embed, but I wanted something 'old school'.

If your workflow involves embedding multiple files, regenerating frequently your embedded data, then you definitely have to choose the embed package.

file2go's People

Contributors

lucasepe avatar

Watchers

 avatar

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.