Giter Site home page Giter Site logo

ar's People

Contributors

blakesmith avatar mvo5 avatar qulogic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ar's Issues

Support chunked file writing

This is really a superset of #4.

Currently,

ar/writer.go

Lines 93 to 96 in 809d437

if len(b)%2 == 1 { // data size must be aligned to an even byte
n2, _ := aw.w.Write([]byte{'\n'})
return n+n2, err
}

essentially closes the file after each call to Write, which means you can't use the API to write a file one piece at a time (e.g. with io.Copy, or dumping out from a stream),

It should only write that footer when aw.nb == 0.

In my opinion, the best way to handle this would be to follow the example of archive/tar and don't write the file footer until either the next call to WriteHeader() or Close(). Of course that would require introduction of a Close method, which would be a breaking API change.

When given a ReaderAt, support returning a SectionReader

Returning []bytes means that tools using this library need to have enough memory available to store the data they're reading, even if the algorithms they're applying to that data would work just as well on a stream with constant memory requirements.

It would be helpful to be able to retrieve not just a file's contents, but a SectionReader that would let those contents be read directly from the underlying storage at a later time, when a seekable backing store is available.


I'm willing to do the work to implement this myself; this issue is provided as a vehicle for discussion, to ensure that the concept is acceptable before I go writing code.

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.