parent
							
								
									bfbc829cd9
								
							
						
					
					
						commit
						a986df0fa7
					
				
							
								
								
									
										13
									
								
								index.js
								
								
								
								
							
							
						
						
									
										13
									
								
								index.js
								
								
								
								
							|  | @ -21,10 +21,7 @@ class Stats { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const VERSION = +process.versions.node | const VERSION = +process.versions.node.split('.').slice(0, 2).join('.') | ||||||
|   .split('.') |  | ||||||
|   .slice(0, 2) |  | ||||||
|   .join('.') |  | ||||||
| 
 | 
 | ||||||
| const EMPTY_STAT = new Stats() | const EMPTY_STAT = new Stats() | ||||||
| 
 | 
 | ||||||
|  | @ -201,17 +198,17 @@ const Iofs = { | ||||||
|    */ |    */ | ||||||
|   rm(origin, debug) { |   rm(origin, debug) { | ||||||
|     try { |     try { | ||||||
|       if (this.isdir(origin)) { |       if (VERSION >= 14.14) { | ||||||
|         if (VERSION > 12.1) { |         FS.rmSync(origin, { recursive: true }) | ||||||
|           FS.rmdirSync(origin, { recursive: true }) |  | ||||||
|       } else { |       } else { | ||||||
|  |         if (this.isdir(origin)) { | ||||||
|           var list = this.ls(origin) |           var list = this.ls(origin) | ||||||
|           list.forEach(it => this.rm(it)) |           list.forEach(it => this.rm(it)) | ||||||
|           FS.rmdirSync(origin) |           FS.rmdirSync(origin) | ||||||
|         } |  | ||||||
|         } else { |         } else { | ||||||
|           FS.unlinkSync(origin) |           FS.unlinkSync(origin) | ||||||
|         } |         } | ||||||
|  |       } | ||||||
|       return true |       return true | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|       debug && console.error('call rm(): ', err + '') |       debug && console.error('call rm(): ', err + '') | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								index.mjs
								
								
								
								
							
							
						
						
									
										13
									
								
								index.mjs
								
								
								
								
							|  | @ -21,10 +21,7 @@ class STATS { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const VERSION = +process.versions.node | const VERSION = +process.versions.node.split('.').slice(0, 2).join('.') | ||||||
|   .split('.') |  | ||||||
|   .slice(0, 2) |  | ||||||
|   .join('.') |  | ||||||
| 
 | 
 | ||||||
| const EMPTY_STAT = new STATS() | const EMPTY_STAT = new STATS() | ||||||
| 
 | 
 | ||||||
|  | @ -201,17 +198,17 @@ export default { | ||||||
|    */ |    */ | ||||||
|   rm(origin, debug) { |   rm(origin, debug) { | ||||||
|     try { |     try { | ||||||
|       if (this.isdir(origin)) { |       if (VERSION >= 14.14) { | ||||||
|         if (VERSION > 12.1) { |         FS.rmSync(origin, { recursive: true }) | ||||||
|           FS.rmdirSync(origin, { recursive: true }) |  | ||||||
|       } else { |       } else { | ||||||
|  |         if (this.isdir(origin)) { | ||||||
|           var list = this.ls(origin) |           var list = this.ls(origin) | ||||||
|           list.forEach(it => this.rm(it)) |           list.forEach(it => this.rm(it)) | ||||||
|           FS.rmdirSync(origin) |           FS.rmdirSync(origin) | ||||||
|         } |  | ||||||
|         } else { |         } else { | ||||||
|           FS.unlinkSync(origin) |           FS.unlinkSync(origin) | ||||||
|         } |         } | ||||||
|  |       } | ||||||
|       return true |       return true | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|       debug && console.error('call rm(): ', err + '') |       debug && console.error('call rm(): ', err + '') | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								package.json
								
								
								
								
							
							
						
						
									
										14
									
								
								package.json
								
								
								
								
							|  | @ -1,13 +1,23 @@ | ||||||
| { | { | ||||||
|   "name": "iofs", |   "name": "iofs", | ||||||
|   "version": "1.5.2", |   "version": "1.5.3", | ||||||
|   "description": "iofs是一个基于原生fs模块封装的工具, 旨在提供更加方便实用一些常用的API方法(同步), API习惯参考了bash shell。", |   "description": "iofs是一个基于原生fs模块封装的工具, 旨在提供更加方便实用一些常用的API方法(同步), API习惯参考了bash shell。", | ||||||
|   "main": "index.js", |   "main": "index.js", | ||||||
|  |   "exports": { | ||||||
|  |     "require": "./index.js", | ||||||
|  |     "import": "./index.mjs" | ||||||
|  |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "https://github.com/bytedo/iofs.git" |     "url": "https://github.com/bytedo/iofs.git" | ||||||
|   }, |   }, | ||||||
|   "keywords": ["fivejs", "fs", "iofs", "fs.io", "file"], |   "keywords": [ | ||||||
|  |     "fivejs", | ||||||
|  |     "fs", | ||||||
|  |     "iofs", | ||||||
|  |     "fs.io", | ||||||
|  |     "file" | ||||||
|  |   ], | ||||||
|   "author": "yutent", |   "author": "yutent", | ||||||
|   "license": "MIT" |   "license": "MIT" | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue