This file contains 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
#!/usr/bin/nodejs | |
var levelup = require('levelup'); | |
var http = require('http'); | |
var util = require('util'); | |
var Transform = require('stream').Transform || require('readable-stream').Transform; | |
var server = http.createServer(onRequest); | |
// Save something in db |
This file contains 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 stream = require('readable-stream'); | |
var mmm = require('mmmagic'); | |
var mimeChecker = new stream.Transform(); | |
mimeChecker.data = []; | |
mimeChecker.mimeFound = false; | |
mimeChecker._transform = function (chunk, encoding, done) { | |
var self = this; | |
if (self.mimeFound) { | |
self.push(chunk); |