comparison xml/en/docs/njs/reference.xml @ 2509:827a6d7fe108

Reordered alphabetically njs file system methods.
author Yaroslav Zhuravlev <yar@nginx.com>
date Wed, 04 Mar 2020 18:36:30 +0000
parents d3d5b67a1462
children 6ce28e0beec0
comparison
equal deleted inserted replaced
2508:d3d5b67a1462 2509:827a6d7fe108
1285 or an object with an encoding property specifying the character encoding 1285 or an object with an encoding property specifying the character encoding
1286 to use for the path passed to the callback 1286 to use for the path passed to the callback
1287 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). 1287 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>).
1288 </tag-desc> 1288 </tag-desc>
1289 1289
1290 <tag-name id="fs_renamesync"><literal>renameSync(<value>oldPath</value>,
1291 <value>newPath</value>)</literal></tag-name>
1292 <tag-desc>
1293 Synchronously changes the name or location of a file from
1294 <literal>oldPath</literal> to <literal>newPath</literal>
1295 (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>).
1296 <example>
1297 >> var fs = require('fs')
1298 undefined
1299 >> var file = fs.renameSync('hello.txt', 'HelloWorld.txt')
1300 undefined
1301 </example>
1302 </tag-desc>
1303
1304 <tag-name id="fs_symlinksync"><literal>symlinkSync(<value>target</value>,
1305 <value>path</value>)</literal></tag-name>
1306 <tag-desc>
1307 Synchronously creates the link called <literal>path</literal>
1308 pointing to <literal>target</literal> using
1309 <link url="http://man7.org/linux/man-pages/man2/symlink.2.html">symlink(2)</link>
1310 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>).
1311 Relative targets are relative to the link’s parent directory.
1312 </tag-desc>
1313
1314 <tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name>
1315 <tag-desc>
1316 Synchronously unlinks a file by <literal>path</literal>
1317 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>).
1318 </tag-desc>
1319
1290 <tag-name id="writefilesync"><literal>writeFileSync(<value>filename</value>, 1320 <tag-name id="writefilesync"><literal>writeFileSync(<value>filename</value>,
1291 <value>data</value>[, 1321 <value>data</value>[,
1292 <value>options</value>])</literal></tag-name> 1322 <value>options</value>])</literal></tag-name>
1293 <tag-desc> 1323 <tag-desc>
1294 Synchronously writes <literal>data</literal> to a file 1324 Synchronously writes <literal>data</literal> to a file
1316 >> var file = fs.writeFileSync('hello.txt', 'Hello world') 1346 >> var file = fs.writeFileSync('hello.txt', 'Hello world')
1317 undefined 1347 undefined
1318 </example> 1348 </example>
1319 </tag-desc> 1349 </tag-desc>
1320 1350
1321 <tag-name id="fs_renamesync"><literal>renameSync(<value>oldPath</value>,
1322 <value>newPath</value>)</literal></tag-name>
1323 <tag-desc>
1324 Synchronously changes the name or location of a file from
1325 <literal>oldPath</literal> to <literal>newPath</literal>
1326 (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>).
1327 <example>
1328 >> var fs = require('fs')
1329 undefined
1330 >> var file = fs.renameSync('hello.txt', 'HelloWorld.txt')
1331 undefined
1332 </example>
1333 </tag-desc>
1334
1335 <tag-name id="fs_symlinksync"><literal>symlinkSync(<value>target</value>,
1336 <value>path</value>)</literal></tag-name>
1337 <tag-desc>
1338 Synchronously creates the link called <literal>path</literal>
1339 pointing to <literal>target</literal> using
1340 <link url="http://man7.org/linux/man-pages/man2/symlink.2.html">symlink(2)</link>
1341 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>).
1342 Relative targets are relative to the link’s parent directory.
1343 </tag-desc>
1344
1345 <tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name>
1346 <tag-desc>
1347 Synchronously unlinks a file by <literal>path</literal>
1348 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>).
1349 </tag-desc>
1350
1351 </list> 1351 </list>
1352 </para> 1352 </para>
1353 1353
1354 1354
1355 <section id="access_const" name="File Access Constants"> 1355 <section id="access_const" name="File Access Constants">