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.
		
		
		
		
		
			
		
			
				
					24 lines
				
				947 B
			
		
		
			
		
	
	
					24 lines
				
				947 B
			| 
								 
											2 years ago
										 
									 | 
							
								import { ReadStreamTokenizer } from './ReadStreamTokenizer.js';
							 | 
						||
| 
								 | 
							
								import { BufferTokenizer } from './BufferTokenizer.js';
							 | 
						||
| 
								 | 
							
								export { EndOfStreamError } from 'peek-readable';
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Construct ReadStreamTokenizer from given Stream.
							 | 
						||
| 
								 | 
							
								 * Will set fileSize, if provided given Stream has set the .path property/
							 | 
						||
| 
								 | 
							
								 * @param stream - Read from Node.js Stream.Readable
							 | 
						||
| 
								 | 
							
								 * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream.
							 | 
						||
| 
								 | 
							
								 * @returns ReadStreamTokenizer
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								export function fromStream(stream, fileInfo) {
							 | 
						||
| 
								 | 
							
								    fileInfo = fileInfo ? fileInfo : {};
							 | 
						||
| 
								 | 
							
								    return new ReadStreamTokenizer(stream, fileInfo);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Construct ReadStreamTokenizer from given Buffer.
							 | 
						||
| 
								 | 
							
								 * @param uint8Array - Uint8Array to tokenize
							 | 
						||
| 
								 | 
							
								 * @param fileInfo - Pass additional file information to the tokenizer
							 | 
						||
| 
								 | 
							
								 * @returns BufferTokenizer
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								export function fromBuffer(uint8Array, fileInfo) {
							 | 
						||
| 
								 | 
							
								    return new BufferTokenizer(uint8Array, fileInfo);
							 | 
						||
| 
								 | 
							
								}
							 |