This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
level-server with all
npm packages installed. Try it out:
level-server lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Given a database full of files at
./db, create a http server on port 8000
and a multilevel server on port 9000:
$ level-server --path ./db --http 8000 --multilevel 9000
Then connect to it from a client:
var multilevel = require('multilevel'); var getServer = require('multilevel-serve'); var net = require('net'); var db = multilevel.client(getServer.manifest); var server = getServer(db);
Now you can use all of level-serve's api:
server.store('foo', 'Bar! :D');
And then get this file via http:
$ curl http://localhost:8000/files/foo Bar! :D
$ level-server --help Host a standalone LevelDB file server. Usage: level-server [options] Options: --path Serve local database --addr Serve remote database --http Port to host http server on [required] --multilevel, --ml Port to host multilevel server on --keyEncoding keyEncoding for levelUp --valueEncoding valueEncoding for levelUp --help, -h Print usage instructions
$ npm install -g level-server
Copyright (c) 2013 Wayla <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.