You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							21 lines
						
					
					
						
							741 B
						
					
					
				
			
		
		
	
	
							21 lines
						
					
					
						
							741 B
						
					
					
				import * as fs from './FsPromise.js';
 | 
						|
import * as core from './core.js';
 | 
						|
export { fromFile } from './FileTokenizer.js';
 | 
						|
export { EndOfStreamError, fromBuffer } from './core.js';
 | 
						|
/**
 | 
						|
 * 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
 | 
						|
 */
 | 
						|
export 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.fromStream(stream, fileInfo);
 | 
						|
}
 |