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.
		
		
		
		
		
			
		
			
				
					
					
						
							22 lines
						
					
					
						
							609 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							22 lines
						
					
					
						
							609 B
						
					
					
				| exports.openZip = openZip; | |
| 
 | |
| var fs = require("fs"); | |
| 
 | |
| var promises = require("./promises"); | |
| var zipfile = require("./zipfile"); | |
| 
 | |
| exports.openZip = openZip; | |
| 
 | |
| var readFile = promises.promisify(fs.readFile); | |
| 
 | |
| function openZip(options) { | |
|     if (options.path) { | |
|         return readFile(options.path).then(zipfile.openArrayBuffer); | |
|     } else if (options.buffer) { | |
|         return promises.resolve(zipfile.openArrayBuffer(options.buffer)); | |
|     } else if (options.file) { | |
|         return promises.resolve(options.file); | |
|     } else { | |
|         return promises.reject(new Error("Could not find file in options")); | |
|     } | |
| }
 | |
| 
 |