$ npm install librarian
const librarian = require('librarian')let app = librarian()app.listen(8888)
See configuration for more options.
const request = require('request')const fs = require('fs')let fileStream = fs.createReadStream(__dirname + '/test-image.png')fileStream.pipe(request.post('http://localhost:8888'))
<form method="POST" action="http://localhost:8888" enctype="multipart/form-data"> <input type="file" name="file"> <button type="submit">Upload</button></form>
{ "id": "e10a0a08-1688-4dff-8a26-fea6ff32e2d4", "size": 125731, "name": "test-image.png", "mimeType": "image/jpeg"}
<!-- normal --><img src="http://localhost:8888/e10a0a08-1688-4dff-8a26-fea6ff32e2d4"><!-- resized --><img src="http://localhost:8888/e10a0a08-1688-4dff-8a26-fea6ff32e2d4?width=50"><!-- resized --><img src="http://localhost:8888/e10a0a08-1688-4dff-8a26-fea6ff32e2d4?height=50"><!-- resized --><img src="http://localhost:8888/e10a0a08-1688-4dff-8a26-fea6ff32e2d4?max=50">
const request = require('request')const fs = require('fs')let fileStream = fs.createWriteStream(__dirname + '/test-image.png')request .post('http://localhost:8888/e10a0a08-1688-4dff-8a26-fea6ff32e2d4') .post(fileStream)