Node.js fs get icon of files in directory

拥有回忆 提交于 2019-12-11 09:36:19

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26317050/node-js-fs-get-icon-of-files-in-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!