This article mainly introduces node. fs. fstatSync method usage instructions. This article introduces fs. fstatSync method description, syntax, receiving parameters, use instances, and implementation source code. For more information, see
Method description:
Synchronous version of fstat ().
Method to return an stat array object that contains the following information: (The following information is the file
This article mainly introduces node. fs. fsyncSync method usage instructions. This article introduces fs. fsyncSync method description, syntax, receiving parameters, use instances and implementation source code. For more information, see
Method description:
Synchronous version of fsync (). Synchronize disk cache.
Syntax:
The Code is as follows:
Fs. fsyn
A simple node. JS File System (fs) read/write example.In nodejs, you can use the fs (file system) module to perform file I/O operations. API link address: the use of fs File System under the http://nodeapi.ucdok.com/#/api/fs.html instance: 1, the module call declaration: var fs = require ('
Suffixation.Another method of module retroflex suffixation exposing the interfaceDirectly attaches the method that needs to be exposed to the exports object as an Attribute. The effect is the same as the above method, Let's modify the Module02.js codefunction fn01 () { // Write a method fn01 console.log ("module02-fn01");} function fn02 () { // Write a method fn02 console.log ("module02-fn02");} // Exposed interface Export.fn01 == fn02;When you run test.js, the effect is the same as the
First, the opening analysis
The file system module is a simple packaged standard POSIX file I/O operation method Set. You can get the module by calling require ("FS"). All methods in the file system module have asynchronous and synchronized versions.
(1), the asynchronous method in the file system module requires a complete callback function as the last incoming parameter.
(2) The composition of the callback function is determined by the calling as
This article mainly introduces node. fs. readdirSync method usage instructions. This article introduces fs. readdirSync method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
The synchronous version of fs. readdir ().
The method returns an array object containing "names of all o
This article mainly introduces node. fs. description of the read method. This article introduces the fs. read method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
Reads file data based on the specified file descriptor fd and writes it to the buffer object pointed to by the buffer. Compared with readFile, it provides a more u
This article mainly introduces node. fs. description of the writeFileSync method. This article introduces fs. writeFileSync method description, syntax, receiving parameters, use instances, and implementation source code. For more information, see
Method description:
Synchronous version of fs. writeFile ().
Syntax:
The Code is as follows:
This article mainly introduces node. fs. readdirSync method usage instructions. This article introduces fs. readdirSync method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
The synchronous version of fs. readdir ().
The method returns an array object containing "names of all o
This article mainly introduces node. fs. mkdirSync method usage instructions. This article introduces fs. mkdirSync method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
Synchronous version of fs. mkdir ().
Syntax:
The code is as follows:
This article mainly introduces node. fs. futimes method usage instructions. This article introduces fs. futimes method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
Changes the timestamp of the file referenced by the file descriptor provided by a file.
Change timestamp
Syntax:
The code is as follows:
This article mainly introduces node. fs. mkdir method usage instructions. This article introduces fs. mkdir method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
Create a file directory asynchronously. If the directory already exists, an exception is thrown.
Syntax:
The code is as follows:
This article mainly introduces node. fs. rmdirSync method usage instructions. This article introduces fs. rmdirSync method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
The synchronous version of rmdir ().
If the returned value is null or undefined, the deletion is successful. Otherwise, an exception is thrown.
Syntax:
This article mainly introduces node. fs. rmdirSync method usage instructions. This article introduces fs. rmdirSync method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
The synchronous version of rmdir ().
If the returned value is null or undefined, the deletion is successful. Otherwise, an exception is thrown.
Syntax:
This article mainly introduces node. fs. rmdir method usage instructions. This article introduces fs. rmdir method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
Delete the file directory asynchronously.
Syntax:
The Code is as follows:
Fs. rmdir (path, [callback (err)])
Because
To continue our experiment, the previous steps can be returned to theFirst article: http://gshao.blog.51cto.com/3512873/1788027Article Two: http://gshao.blog.51cto.com/3512873/1788038Article Three: http://gshao.blog.51cto.com/3512873/1788048----------------------------------I'm a slightly soiled mid-line-------------------------------------The approximate idea steps are as follows:1. Add a UPN to configure the user's UPN suffix (this is related to whether or not your domain name is consistent, i
Description of the fs. truncateSync method in node. js, node. jsfs
Method description:
Truncate () of the synchronous version.
Syntax:
Copy codeThe Code is as follows:Fs. truncateSync (path, len)
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("
FS module is the encapsulation of file operation, it provides the file read, write, rename, delete, traverse directory, link and other POSIX file system operation. Unlike other modules, all operations in the FS module provide asynchronous and synchronized two versions, such as functions that read the contents of a file with asynchronous Fs.readfile () and synchronous Fs.readfilesync (). We represent the fun
This article mainly introduces node. fs. futimes method usage instructions. This article introduces fs. futimes method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
Changes the timestamp of the file referenced by the file descriptor provided by a file.
Change Timestamp
Syntax:
The Code is as follows:
This article mainly introduces node. fs. mkdir method usage instructions. This article introduces fs. mkdir method description, syntax, receive parameters, use instances, and implement Source Code. For more information, see
Method description:
Create a file directory asynchronously. If the directory already exists, an exception is thrown.
Syntax:
The Code is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.