简体   繁体   中英

Node.js fs get icon of files in directory

I want to build a file system explorer app, and I want to list files with icons. I use node-webkit. And files can be executables, directories and normally files. In file list I want to diplay files icon and name.

Can I use node.js fs module for getting icons? Or there a module for reading icons?

How can I get icon of file?

Icons are dependent on the operating system / browser application and aren't a generic interface provided by node.js - you instead need to first resolve the type of file, then pick and show the icon for that type of file.

You can use the fs module for resolving the type - especially stats .

The type of icon to show is up to you - some operating systems may provide these for you, but it is up to you to find their location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM