Cross-platform if you want
Paths
Use path.resolve to traverse the filesystem
Use path.normalize to create reliable paths
Use path.join to join folder names
Scripts in package.json
Join shell commands with a double ampersand instead of a semi-colon
Cross Platform Newline Characters
Temporary files
Home directories
Use the os module for more control
Conclusion
References
Cross-platform if you want
Node.js is cross-platform meaning it works on Windows, OSX and Linux. A large number of the Node.js community write Node.js on OSX and then deploy to Linux servers. Because OSX and Linux are based on UNIX this tends to just work. Windows support is a first-class citizen in Node.js and if you learn to use Node.js in the right way you can make sure that you can welcome your Windows friends to your code party.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)