'use strict';

var index = require('../../../_virtual/index4.js');
require('./FsPromise.js');
require('./core.js');
require('./FileTokenizer.js');
var FileTokenizer = require('../../../_virtual/FileTokenizer.js');
var core = require('../../../_virtual/core.js');
var FsPromise = require('../../../_virtual/FsPromise.js');

(function (exports) {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.fromStream = exports.fromBuffer = exports.EndOfStreamError = exports.fromFile = void 0;
	const fs = FsPromise.__exports;
	const core$1 = core.__exports;
	var FileTokenizer_1 = FileTokenizer.__exports;
	Object.defineProperty(exports, "fromFile", { enumerable: true, get: function () { return FileTokenizer_1.fromFile; } });
	var core_1 = core.__exports;
	Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return core_1.EndOfStreamError; } });
	Object.defineProperty(exports, "fromBuffer", { enumerable: true, get: function () { return core_1.fromBuffer; } });
	/**
	 * Construct ReadStreamTokenizer from given Stream.
	 * Will set fileSize, if provided given Stream has set the .path property.
	 * @param stream - Node.js Stream.Readable
	 * @param fileInfo - Pass additional file information to the tokenizer
	 * @returns Tokenizer
	 */
	async function fromStream(stream, fileInfo) {
	    fileInfo = fileInfo ? fileInfo : {};
	    if (stream.path) {
	        const stat = await fs.stat(stream.path);
	        fileInfo.path = stream.path;
	        fileInfo.size = stat.size;
	    }
	    return core$1.fromStream(stream, fileInfo);
	}
	exports.fromStream = fromStream; 
} (index.__exports));
