<commit_before>var path = require('path'),
    stream = require('stream')

function createWritable (write, highWaterMark) {
    var writable = new stream.Writable({ highWaterMark: highWaterMark || 1024 * 16 })
    writable._write = write
    return writable
}

function write (chunk, encoding, callback) {
    callback()
}

require('proof')(1, function (step) {
    var rimraf = require('rimraf')
    step([function () {
        rimraf(path.join(__dirname, 'tmp'), step())
    }, function (_, error) {
        if (error.code != "ENOENT") throw error
    }])
}, function (step, ok) {
    var mkdirp = require('mkdirp'),
        Staccato = require('../..'),
        staccato
    step(function () {
        mkdirp(path.join(__dirname, 'tmp'), step())
    }, function () {
        staccato = new Staccato(createWritable(write), false)
        ok(staccato, 'create')
        staccato.ready(step())
    }, function () {
        staccato.write(new Buffer(1024), step())
    }, function () {
        staccato.close(step())
    })
})<commit_msg>Test `open` event.<commit_after>var path = require('path'),
    stream = require('stream')

function createWritable (write, highWaterMark) {
    var writable = new stream.Writable({ highWaterMark: highWaterMark || 1024 * 16 })
    writable._write = write
    return writable
}

function write (chunk, encoding, callback) {
    callback()
}

require('proof')(2, function (step) {
    var rimraf = require('rimraf')
    step([function () {
        rimraf(path.join(__dirname, 'tmp'), step())
    }, function (_, error) {
        if (error.code != "ENOENT") throw error
    }])
}, function (step, ok) {
    var mkdirp = require('mkdirp'),
        Staccato = require('../..'),
        staccato
    step(function () {
        mkdirp(path.join(__dirname, 'tmp'), step())
    }, function () {
        staccato = new Staccato(createWritable(write), false)
        ok(staccato, 'create')
        staccato.ready(step())
    }, function () {
        staccato.write(new Buffer(1024), step())
    }, function () {
        staccato.close(step())
    }, function () {
        var writable
        staccato = new Staccato(writable = createWritable(write), true)
        staccato.ready(step())
        writable.emit('open')
    }, function () {
        ok(1, 'opened')
        staccato.close(step())
    })
})
{'fraction_non_alphanumeric': 0.1640893470790378, 'fraction_numerical': 0.009879725085910653, 'mean_word_length': 2.7993474714518762, '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': '2447786', 'n_tokens_mistral': 739, 'n_tokens_neox': 715, 'n_words': 158}