Unzip an entry to memory in Racket -
i'm trying read file entry. program have now:
#lang racket (require file/unzip) (require xml) (define (get-content file-name) (let ([in (open-input-file file-name #:mode 'binary)]) (unzip-entry in (read-zip-directory in) #"content.xml")))
currently program writes file content.xml
filesystem. need have stored in memory (either output port, or string, or return value) instead of polluting filesystem. tell me please how can that?
yes, can this, passing in custom entry-reader
parameter unzip-entry
. here's example of how it:
(define (unzip-entry->bytes path zipdir entry) (call-with-output-bytes (lambda (out) (unzip-entry path zipdir entry (lambda (name dir? in) (copy-port in out))))))
Comments
Post a Comment