<commit_before>// The leveldb storage layer
// sublevel + levelup + leveldown-hyper
// sublevel == buckets

var
	levelup   = require('levelup'),
	sublevel  = require('level-sublevel'),
	P         = require('p-promise'),
	util      = require('util')
	;

function LocalNode(opts)
{
	this.id = opts.id;
	this.db = sublevel(levelup(opts.dbpath));
	this.logger = opts.logger;
	// etc
}


LocalNode.prototype.save = function(bucket, id, body)
{
	var deferred = P.defer();

	var sublevel = this.db.sublevel(bucket);<commit_msg>If the dbpath doesn't exist, make it.<commit_after>// The leveldb storage layer
// sublevel + levelup + leveldown-hyper
// sublevel == buckets

var
	fs       = require('fs'),
	levelup  = require('levelup'),
	sublevel = require('level-sublevel'),
	P        = require('p-promise'),
	path     = require('path'),
	util     = require('util')
	;

function LocalNode(opts)
{
	this.id     = opts.id;
	this.logger = opts.logger;
	// etc

	var cwd = process.cwd();
	var dbpath = path.normalize(path.join(cwd, opts.dbpath));
	if (!fs.existsSync(dbpath))
		fs.mkdirSync(dbpath);

	this.db = sublevel(levelup(dbpath));
}

LocalNode.prototype.save = function(bucket, id, body)
{
	var deferred = P.defer();

	var sublevel = this.db.sublevel(bucket);
{'fraction_non_alphanumeric': 0.16028708133971292, 'fraction_numerical': 0.0, 'mean_word_length': 3.6309963099630997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '60815', 'n_tokens_mistral': 452, 'n_tokens_neox': 439, 'n_words': 95}