- Mastering Node.js(Second Edition)
- Sandro Pasquali Kevin Faaborg
- 243字
- 2021-07-02 19:28:37
POSIX
POSIX, the Portable Operating System Interface, defines the standard APIs for Unix. It's adopted in Unix-based operating systems and beyond. The IEEE created and maintains the POSIX standard to enable systems from different manufacturers to be compatible. Write your C program using POSIX APIs on your laptop running macOS, and you'll have an easier time later building it on a Raspberry Pi.
As a common denominator, POSIX is old, simple, and most importantly, well-known to developers of all stripes. To make a new directory in a C program, use this API:
int mkdir(const char *path, mode_t mode);
And here it is in Node:
fs.mkdir(path[, mode], callback)
The Node documentation for the filesystem module starts out by telling the developer, there's nothing new here:
File I/O is provided by simple wrappers around standard POSIX functions.
https://nodejs.org/api/fs.html
For Node, Ryan Dahl implemented proven POSIX APIs, rather than trying to come up with something on his own. While such an attempt might be better in some ways, or some situations, it would lose the instant familiarity that POSIX gives to new Node developers trained in other systems.
In choosing POSIX for the API, Node is in no way limited to the standards from the 1970s. It's easy for anyone to write their own module that calls down to Node's API, while presenting a different one upwards. These fancier alternatives can then compete in a Darwinian quest to prove themselves better than POSIX.
- 微商之道
- Web安全防護指南:基礎篇
- SEO 20日
- Truffle Quick Start Guide
- 電子政務效益的經濟分析與評價
- 網絡互聯技術(實踐篇)
- 物聯網與無線傳感器網絡
- Mastering JavaFX 10
- Metasploit Penetration Testing Cookbook
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- Mastering Dart
- Master Apache JMeter:From Load Testing to DevOps
- 語音信號處理及Blackfin DSP實現
- 5G+區塊鏈
- 轉化:提升網站流量和轉化率的技巧