<commit_before>import stream from 'readable-stream'
import buffer from 'buffer'

// from https://github.com/bergos/nodeify-fetch/blob/master/lib/WhatwgReadable.js
class WhatwgReadable extends stream.Readable {
    public constructor(body: ReadableStream) {
        super({
            read: () => {
                body.getReader().read().then((chunk) => {
                    if (chunk.done) {<commit_msg>fix: ensure body reader is opened only once<commit_after>import stream from 'readable-stream'
import buffer from 'buffer'

// from https://github.com/bergos/nodeify-fetch/blob/master/lib/WhatwgReadable.js
class WhatwgReadable extends stream.Readable {
    public constructor(body: ReadableStream) {
        let reader: ReturnType<ReadableStream['getReader']>
        function getReader() {
            if (!reader) {
                reader = body.getReader()
            }

            return reader
        }

        super({
            read: () => {
                getReader().read().then((chunk) => {
                    if (chunk.done) {
{'fraction_non_alphanumeric': 0.12011439466158245, 'fraction_numerical': 0.0, 'mean_word_length': 2.260869565217391, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 2, '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': '1853919', 'n_tokens_mistral': 293, 'n_tokens_neox': 279, 'n_words': 62}