Created
February 16, 2013 00:02
-
-
Save gjohnson/4964657 to your computer and use it in GitHub Desktop.
padding hack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var padding = { | |
'128': pad(128), | |
'512': pad(512) | |
}; | |
collection.insert({ | |
aliases: [ padding['128'] ], | |
profile: { 'noop': padding['512'] }, | |
}, function(err, doc){ | |
var query = { _id: doc._id }; | |
var update = { $unset: { 'profile.noop': 1 }, $pop: { 'aliases': -1 } }; | |
collection.update(query, update, noop); | |
}); | |
function pad(bytes){ | |
var buff = new Buffer(bytes); | |
buff.fill(0); | |
return buff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment