zero copy blob
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
var fd = use("fd")
|
||||
var miniz = use("miniz")
|
||||
var utf8 = use("utf8")
|
||||
|
||||
return {
|
||||
create_and_read_zip: function() {
|
||||
@@ -35,7 +34,7 @@ return {
|
||||
disrupt
|
||||
|
||||
extracted_blob = reader.slurp(ENTRY_PATH)
|
||||
extracted_text = utf8.decode(extracted_blob)
|
||||
extracted_text = text(extracted_blob)
|
||||
|
||||
if (extracted_text != PAYLOAD)
|
||||
disrupt
|
||||
@@ -59,8 +58,8 @@ return {
|
||||
|
||||
var _run = function() {
|
||||
writer = miniz.write(ZIP_PATH)
|
||||
writer.add_file(ENTRY1, utf8.encode("content1"))
|
||||
writer.add_file(ENTRY2, utf8.encode("content2"))
|
||||
writer.add_file(ENTRY1, blob("content1"))
|
||||
writer.add_file(ENTRY2, blob("content2"))
|
||||
writer = null
|
||||
|
||||
zip_blob = fd.slurp(ZIP_PATH)
|
||||
@@ -87,7 +86,7 @@ return {
|
||||
|
||||
var _run = function() {
|
||||
writer = miniz.write(ZIP_PATH)
|
||||
writer.add_file(ENTRY_PATH, utf8.encode("data"))
|
||||
writer.add_file(ENTRY_PATH, blob("data"))
|
||||
writer = null
|
||||
|
||||
zip_blob = fd.slurp(ZIP_PATH)
|
||||
|
||||
Reference in New Issue
Block a user