2
0

nixio.fs.html 20 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <title>Reference</title>
  6. <link rel="stylesheet" href="../luadoc.css" type="text/css" />
  7. <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li>
  26. <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
  27. </li>
  28. <li>
  29. <a href="../modules/luci.http.html">luci.http</a>
  30. </li>
  31. <li>
  32. <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
  33. </li>
  34. <li>
  35. <a href="../modules/luci.http.date.html">luci.http.date</a>
  36. </li>
  37. <li>
  38. <a href="../modules/luci.http.mime.html">luci.http.mime</a>
  39. </li>
  40. <li>
  41. <a href="../modules/luci.i18n.html">luci.i18n</a>
  42. </li>
  43. <li>
  44. <a href="../modules/luci.ip.html">luci.ip</a>
  45. </li>
  46. <li>
  47. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  48. </li>
  49. <li>
  50. <a href="../modules/luci.json.html">luci.json</a>
  51. </li>
  52. <li>
  53. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  54. </li>
  55. <li>
  56. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  57. </li>
  58. <li>
  59. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  60. </li>
  61. <li>
  62. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  63. </li>
  64. <li>
  65. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  66. </li>
  67. <li>
  68. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  69. </li>
  70. <li>
  71. <a href="../modules/luci.sys.html">luci.sys</a>
  72. </li>
  73. <li>
  74. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  75. </li>
  76. <li>
  77. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  78. </li>
  79. <li>
  80. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  81. </li>
  82. <li>
  83. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  84. </li>
  85. <li>
  86. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  87. </li>
  88. <li>
  89. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  90. </li>
  91. <li>
  92. <a href="../modules/luci.util.html">luci.util</a>
  93. </li>
  94. <li>
  95. <a href="../modules/nixio.html">nixio</a>
  96. </li>
  97. <li>
  98. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  99. </li>
  100. <li>
  101. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  102. </li>
  103. <li>
  104. <a href="../modules/nixio.File.html">nixio.File</a>
  105. </li>
  106. <li>
  107. <a href="../modules/nixio.README.html">nixio.README</a>
  108. </li>
  109. <li>
  110. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  111. </li>
  112. <li>
  113. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  114. </li>
  115. <li>
  116. <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
  117. </li>
  118. <li>
  119. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  120. </li>
  121. <li>
  122. <a href="../modules/nixio.bin.html">nixio.bin</a>
  123. </li>
  124. <li>
  125. <a href="../modules/nixio.bit.html">nixio.bit</a>
  126. </li>
  127. <li>
  128. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  129. </li>
  130. <li><strong>nixio.fs</strong></li>
  131. </ul>
  132. <!-- File list -->
  133. </div><!-- id="navigation" -->
  134. <div id="content">
  135. <h1>Class <code>nixio.fs</code></h1>
  136. <p>
  137. Low-level and high-level filesystem manipulation library.</p>
  138. <h2>Functions</h2>
  139. <table class="function_list">
  140. <tr>
  141. <td class="name" nowrap><a href="#nixio.fs.access">access</a>&nbsp;(path, mode1, ...)</td>
  142. <td class="summary">
  143. Check user's permission on a file.</td>
  144. </tr>
  145. <tr>
  146. <td class="name" nowrap><a href="#nixio.fs.basename">basename</a>&nbsp;(path)</td>
  147. <td class="summary">
  148. Strip the directory part from a path.</td>
  149. </tr>
  150. <tr>
  151. <td class="name" nowrap><a href="#nixio.fs.chmod">chmod</a>&nbsp;(path, mode)</td>
  152. <td class="summary">
  153. Change the file mode.</td>
  154. </tr>
  155. <tr>
  156. <td class="name" nowrap><a href="#nixio.fs.chown">chown</a>&nbsp;(path, user, group)</td>
  157. <td class="summary">
  158. (POSIX) Change owner and group of a file.</td>
  159. </tr>
  160. <tr>
  161. <td class="name" nowrap><a href="#nixio.fs.copy">copy</a>&nbsp;(src, dest)</td>
  162. <td class="summary">
  163. Copy a file, directory or symlink non-recursively preserving file mode,
  164. timestamps, owner and group.</td>
  165. </tr>
  166. <tr>
  167. <td class="name" nowrap><a href="#nixio.fs.copyr">copyr</a>&nbsp;(src, dest)</td>
  168. <td class="summary">
  169. Copy a file, directory or symlink recursively preserving file mode,
  170. timestamps, owner and group.</td>
  171. </tr>
  172. <tr>
  173. <td class="name" nowrap><a href="#nixio.fs.datacopy">datacopy</a>&nbsp;(src, dest, limit)</td>
  174. <td class="summary">
  175. Copy data between files.</td>
  176. </tr>
  177. <tr>
  178. <td class="name" nowrap><a href="#nixio.fs.dir">dir</a>&nbsp;(path)</td>
  179. <td class="summary">
  180. Iterate over the entries of a directory.</td>
  181. </tr>
  182. <tr>
  183. <td class="name" nowrap><a href="#nixio.fs.dirname">dirname</a>&nbsp;(path)</td>
  184. <td class="summary">
  185. Strip the base from a path.</td>
  186. </tr>
  187. <tr>
  188. <td class="name" nowrap><a href="#nixio.fs.glob">glob</a>&nbsp;(pattern)</td>
  189. <td class="summary">
  190. (POSIX) Find pathnames matching a pattern.</td>
  191. </tr>
  192. <tr>
  193. <td class="name" nowrap><a href="#nixio.fs.lchown">lchown</a>&nbsp;(path, user, group)</td>
  194. <td class="summary">
  195. (POSIX) Change owner and group of a file and do not resolve
  196. if target is a symlink.</td>
  197. </tr>
  198. <tr>
  199. <td class="name" nowrap><a href="#nixio.fs.link">link</a>&nbsp;(oldpath, newpath)</td>
  200. <td class="summary">
  201. Create a hard link.</td>
  202. </tr>
  203. <tr>
  204. <td class="name" nowrap><a href="#nixio.fs.lstat">lstat</a>&nbsp;(path, field)</td>
  205. <td class="summary">
  206. Get file status and attributes and do not resolve if target is a symlink.</td>
  207. </tr>
  208. <tr>
  209. <td class="name" nowrap><a href="#nixio.fs.mkdir">mkdir</a>&nbsp;(path, mode)</td>
  210. <td class="summary">
  211. Create a new directory.</td>
  212. </tr>
  213. <tr>
  214. <td class="name" nowrap><a href="#nixio.fs.mkdirr">mkdirr</a>&nbsp;(dest, mode)</td>
  215. <td class="summary">
  216. Create a directory and all needed parent directories recursively.</td>
  217. </tr>
  218. <tr>
  219. <td class="name" nowrap><a href="#nixio.fs.mkfifo">mkfifo</a>&nbsp;(path, mode)</td>
  220. <td class="summary">
  221. (POSIX) Create a FIFO (named pipe).</td>
  222. </tr>
  223. <tr>
  224. <td class="name" nowrap><a href="#nixio.fs.move">move</a>&nbsp;(src, dest)</td>
  225. <td class="summary">
  226. Rename a file, directory or symlink non-recursively across filesystems.</td>
  227. </tr>
  228. <tr>
  229. <td class="name" nowrap><a href="#nixio.fs.mover">mover</a>&nbsp;(src, dest)</td>
  230. <td class="summary">
  231. Rename a file, directory or symlink recursively across filesystems.</td>
  232. </tr>
  233. <tr>
  234. <td class="name" nowrap><a href="#nixio.fs.readfile">readfile</a>&nbsp;(path, limit)</td>
  235. <td class="summary">
  236. Read the contents of a file into a buffer.</td>
  237. </tr>
  238. <tr>
  239. <td class="name" nowrap><a href="#nixio.fs.readlink">readlink</a>&nbsp;(path)</td>
  240. <td class="summary">
  241. (POSIX) Read the target of a symbolic link.</td>
  242. </tr>
  243. <tr>
  244. <td class="name" nowrap><a href="#nixio.fs.realpath">realpath</a>&nbsp;(path)</td>
  245. <td class="summary">
  246. Return the cannonicalized absolute pathname.</td>
  247. </tr>
  248. <tr>
  249. <td class="name" nowrap><a href="#nixio.fs.remove">remove</a>&nbsp;(path)</td>
  250. <td class="summary">
  251. Remove a file or directory.</td>
  252. </tr>
  253. <tr>
  254. <td class="name" nowrap><a href="#nixio.fs.rename">rename</a>&nbsp;(src, dest)</td>
  255. <td class="summary">
  256. Renames a file or directory.</td>
  257. </tr>
  258. <tr>
  259. <td class="name" nowrap><a href="#nixio.fs.rmdir">rmdir</a>&nbsp;(path)</td>
  260. <td class="summary">
  261. Remove an empty directory.</td>
  262. </tr>
  263. <tr>
  264. <td class="name" nowrap><a href="#nixio.fs.stat">stat</a>&nbsp;(path, field)</td>
  265. <td class="summary">
  266. Get file status and attributes.</td>
  267. </tr>
  268. <tr>
  269. <td class="name" nowrap><a href="#nixio.fs.statvfs">statvfs</a>&nbsp;(path)</td>
  270. <td class="summary">
  271. (POSIX) Get filesystem statistics.</td>
  272. </tr>
  273. <tr>
  274. <td class="name" nowrap><a href="#nixio.fs.symlink">symlink</a>&nbsp;(oldpath, newpath)</td>
  275. <td class="summary">
  276. (POSIX) Create a symbolic link.</td>
  277. </tr>
  278. <tr>
  279. <td class="name" nowrap><a href="#nixio.fs.unlink">unlink</a>&nbsp;(path)</td>
  280. <td class="summary">
  281. Delete a name and - if no links are left - the associated file.</td>
  282. </tr>
  283. <tr>
  284. <td class="name" nowrap><a href="#nixio.fs.utimes">utimes</a>&nbsp;(path, actime, mtime)</td>
  285. <td class="summary">
  286. Change file last access and last modification time.</td>
  287. </tr>
  288. <tr>
  289. <td class="name" nowrap><a href="#nixio.fs.writefile">writefile</a>&nbsp;(path, data)</td>
  290. <td class="summary">
  291. Write a buffer into a file truncating the file first.</td>
  292. </tr>
  293. </table>
  294. <br/>
  295. <br/>
  296. <h2><a name="functions"></a>Functions</h2>
  297. <dl class="function">
  298. <dt><a name="nixio.fs.access"></a><strong>access</strong>&nbsp;(path, mode1, ...)</dt>
  299. <dd>
  300. Check user's permission on a file.
  301. <h3>Parameters</h3>
  302. <ul>
  303. <li>
  304. path: Path
  305. </li>
  306. <li>
  307. mode1: First Mode to check ["f", "r", "w", "x"]
  308. </li>
  309. <li>
  310. ...: More Modes to check [-"-]
  311. </li>
  312. </ul>
  313. <h3>Return value:</h3>
  314. true
  315. </dd>
  316. <dt><a name="nixio.fs.basename"></a><strong>basename</strong>&nbsp;(path)</dt>
  317. <dd>
  318. Strip the directory part from a path.
  319. <h3>Parameters</h3>
  320. <ul>
  321. <li>
  322. path: Path
  323. </li>
  324. </ul>
  325. <h3>Usage:</h3>
  326. This function cannot fail and will never return nil.
  327. <h3>Return value:</h3>
  328. basename
  329. </dd>
  330. <dt><a name="nixio.fs.chmod"></a><strong>chmod</strong>&nbsp;(path, mode)</dt>
  331. <dd>
  332. Change the file mode.
  333. <h3>Parameters</h3>
  334. <ul>
  335. <li>
  336. path: Path
  337. </li>
  338. <li>
  339. mode: File mode
  340. [decimal mode number, "[-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]"]
  341. </li>
  342. </ul>
  343. <h3>Usage</h3>
  344. <ul>
  345. <li>Windows only supports setting the write-protection through the
  346. "Writable to others" bit.
  347. <li><strong>Notice:</strong> The mode-flag for the functions
  348. open, mkdir, mkfifo are affected by the umask.
  349. </ul>
  350. <h3>Return value:</h3>
  351. true
  352. <h3>See also:</h3>
  353. <ul>
  354. <li><a href="">
  355. umask
  356. </a>
  357. </ul>
  358. </dd>
  359. <dt><a name="nixio.fs.chown"></a><strong>chown</strong>&nbsp;(path, user, group)</dt>
  360. <dd>
  361. (POSIX) Change owner and group of a file.
  362. <h3>Parameters</h3>
  363. <ul>
  364. <li>
  365. path: Path
  366. </li>
  367. <li>
  368. user: User ID or Username (optional)
  369. </li>
  370. <li>
  371. group: Group ID or Groupname (optional)
  372. </li>
  373. </ul>
  374. <h3>Return value:</h3>
  375. true
  376. </dd>
  377. <dt><a name="nixio.fs.copy"></a><strong>copy</strong>&nbsp;(src, dest)</dt>
  378. <dd>
  379. Copy a file, directory or symlink non-recursively preserving file mode,
  380. timestamps, owner and group.
  381. <h3>Parameters</h3>
  382. <ul>
  383. <li>
  384. src: Source path
  385. </li>
  386. <li>
  387. dest: Destination path
  388. </li>
  389. </ul>
  390. <h3>Usage:</h3>
  391. The destination must always be a full destination path e.g. do not
  392. omit the basename even if source and destination basename are equal.
  393. <h3>Return value:</h3>
  394. true
  395. </dd>
  396. <dt><a name="nixio.fs.copyr"></a><strong>copyr</strong>&nbsp;(src, dest)</dt>
  397. <dd>
  398. Copy a file, directory or symlink recursively preserving file mode,
  399. timestamps, owner and group.
  400. <h3>Parameters</h3>
  401. <ul>
  402. <li>
  403. src: Source path
  404. </li>
  405. <li>
  406. dest: Destination path
  407. </li>
  408. </ul>
  409. <h3>Usage:</h3>
  410. The destination must always be a full destination path e.g. do not
  411. omit the basename even if source and destination basename are equal.
  412. <h3>Return value:</h3>
  413. true
  414. </dd>
  415. <dt><a name="nixio.fs.datacopy"></a><strong>datacopy</strong>&nbsp;(src, dest, limit)</dt>
  416. <dd>
  417. Copy data between files.
  418. <h3>Parameters</h3>
  419. <ul>
  420. <li>
  421. src: Source file path
  422. </li>
  423. <li>
  424. dest: Destination file path
  425. </li>
  426. <li>
  427. limit: Maximum bytes to copy (optional)
  428. </li>
  429. </ul>
  430. <h3>Return value:</h3>
  431. true
  432. </dd>
  433. <dt><a name="nixio.fs.dir"></a><strong>dir</strong>&nbsp;(path)</dt>
  434. <dd>
  435. Iterate over the entries of a directory.
  436. <h3>Parameters</h3>
  437. <ul>
  438. <li>
  439. path: Path
  440. </li>
  441. </ul>
  442. <h3>Usage:</h3>
  443. The special entries "." and ".." are omitted.
  444. <h3>Return value:</h3>
  445. directory iterator returning one entry per call
  446. </dd>
  447. <dt><a name="nixio.fs.dirname"></a><strong>dirname</strong>&nbsp;(path)</dt>
  448. <dd>
  449. Strip the base from a path.
  450. <h3>Parameters</h3>
  451. <ul>
  452. <li>
  453. path: Path
  454. </li>
  455. </ul>
  456. <h3>Usage:</h3>
  457. This function cannot fail and will never return nil.
  458. <h3>Return value:</h3>
  459. dirname
  460. </dd>
  461. <dt><a name="nixio.fs.glob"></a><strong>glob</strong>&nbsp;(pattern)</dt>
  462. <dd>
  463. (POSIX) Find pathnames matching a pattern.
  464. <h3>Parameters</h3>
  465. <ul>
  466. <li>
  467. pattern: Pattern
  468. </li>
  469. </ul>
  470. <h3>Return values:</h3>
  471. <ol>
  472. <li>path iterator
  473. <li>number of matches
  474. </ol>
  475. </dd>
  476. <dt><a name="nixio.fs.lchown"></a><strong>lchown</strong>&nbsp;(path, user, group)</dt>
  477. <dd>
  478. (POSIX) Change owner and group of a file and do not resolve
  479. if target is a symlink.
  480. <h3>Parameters</h3>
  481. <ul>
  482. <li>
  483. path: Path
  484. </li>
  485. <li>
  486. user: User ID or Username (optional)
  487. </li>
  488. <li>
  489. group: Group ID or Groupname (optional)
  490. </li>
  491. </ul>
  492. <h3>Return value:</h3>
  493. true
  494. </dd>
  495. <dt><a name="nixio.fs.link"></a><strong>link</strong>&nbsp;(oldpath, newpath)</dt>
  496. <dd>
  497. Create a hard link.
  498. <h3>Parameters</h3>
  499. <ul>
  500. <li>
  501. oldpath: Path
  502. </li>
  503. <li>
  504. newpath: Path
  505. </li>
  506. </ul>
  507. <h3>Usage:</h3>
  508. This function calls link() on POSIX and CreateHardLink() on Windows.
  509. <h3>Return value:</h3>
  510. true
  511. </dd>
  512. <dt><a name="nixio.fs.lstat"></a><strong>lstat</strong>&nbsp;(path, field)</dt>
  513. <dd>
  514. Get file status and attributes and do not resolve if target is a symlink.
  515. <h3>Parameters</h3>
  516. <ul>
  517. <li>
  518. path: Path
  519. </li>
  520. <li>
  521. field: Only return a specific field, not the whole table (optional)
  522. </li>
  523. </ul>
  524. <h3>Return value:</h3>
  525. Table containing attributes (see stat for a detailed description)
  526. <h3>See also:</h3>
  527. <ul>
  528. <li><a href="#nixio.fs.stat">
  529. stat
  530. </a>
  531. </ul>
  532. </dd>
  533. <dt><a name="nixio.fs.mkdir"></a><strong>mkdir</strong>&nbsp;(path, mode)</dt>
  534. <dd>
  535. Create a new directory.
  536. <h3>Parameters</h3>
  537. <ul>
  538. <li>
  539. path: Path
  540. </li>
  541. <li>
  542. mode: File mode (optional, see chmod and umask)
  543. </li>
  544. </ul>
  545. <h3>Return value:</h3>
  546. true
  547. <h3>See also:</h3>
  548. <ul>
  549. <li><a href="#nixio.fs.chmod">
  550. chmod
  551. </a>
  552. <li><a href="">
  553. umask
  554. </a>
  555. </ul>
  556. </dd>
  557. <dt><a name="nixio.fs.mkdirr"></a><strong>mkdirr</strong>&nbsp;(dest, mode)</dt>
  558. <dd>
  559. Create a directory and all needed parent directories recursively.
  560. <h3>Parameters</h3>
  561. <ul>
  562. <li>
  563. dest: Destination path
  564. </li>
  565. <li>
  566. mode: File mode (optional, see chmod and umask)
  567. </li>
  568. </ul>
  569. <h3>Return value:</h3>
  570. true
  571. <h3>See also:</h3>
  572. <ul>
  573. <li><a href="#nixio.fs.chmod">
  574. chmod
  575. </a>
  576. <li><a href="">
  577. umask
  578. </a>
  579. </ul>
  580. </dd>
  581. <dt><a name="nixio.fs.mkfifo"></a><strong>mkfifo</strong>&nbsp;(path, mode)</dt>
  582. <dd>
  583. (POSIX) Create a FIFO (named pipe).
  584. <h3>Parameters</h3>
  585. <ul>
  586. <li>
  587. path: Path
  588. </li>
  589. <li>
  590. mode: File mode (optional, see chmod and umask)
  591. </li>
  592. </ul>
  593. <h3>Return value:</h3>
  594. true
  595. <h3>See also:</h3>
  596. <ul>
  597. <li><a href="#nixio.fs.chmod">
  598. chmod
  599. </a>
  600. <li><a href="">
  601. umask
  602. </a>
  603. </ul>
  604. </dd>
  605. <dt><a name="nixio.fs.move"></a><strong>move</strong>&nbsp;(src, dest)</dt>
  606. <dd>
  607. Rename a file, directory or symlink non-recursively across filesystems.
  608. <h3>Parameters</h3>
  609. <ul>
  610. <li>
  611. src: Source path
  612. </li>
  613. <li>
  614. dest: Destination path
  615. </li>
  616. </ul>
  617. <h3>Usage:</h3>
  618. The destination must always be a full destination path e.g. do not
  619. omit the basename even if source and destination basename are equal.
  620. <h3>Return value:</h3>
  621. true
  622. </dd>
  623. <dt><a name="nixio.fs.mover"></a><strong>mover</strong>&nbsp;(src, dest)</dt>
  624. <dd>
  625. Rename a file, directory or symlink recursively across filesystems.
  626. <h3>Parameters</h3>
  627. <ul>
  628. <li>
  629. src: Source path
  630. </li>
  631. <li>
  632. dest: Destination path
  633. </li>
  634. </ul>
  635. <h3>Usage:</h3>
  636. The destination must always be a full destination path e.g. do not
  637. omit the basename even if source and destination basename are equal.
  638. <h3>Return value:</h3>
  639. true
  640. </dd>
  641. <dt><a name="nixio.fs.readfile"></a><strong>readfile</strong>&nbsp;(path, limit)</dt>
  642. <dd>
  643. Read the contents of a file into a buffer.
  644. <h3>Parameters</h3>
  645. <ul>
  646. <li>
  647. path: Path
  648. </li>
  649. <li>
  650. limit: Maximum bytes to read (optional)
  651. </li>
  652. </ul>
  653. <h3>Return value:</h3>
  654. file contents
  655. </dd>
  656. <dt><a name="nixio.fs.readlink"></a><strong>readlink</strong>&nbsp;(path)</dt>
  657. <dd>
  658. (POSIX) Read the target of a symbolic link.
  659. <h3>Parameters</h3>
  660. <ul>
  661. <li>
  662. path: Path
  663. </li>
  664. </ul>
  665. <h3>Return value:</h3>
  666. target path
  667. </dd>
  668. <dt><a name="nixio.fs.realpath"></a><strong>realpath</strong>&nbsp;(path)</dt>
  669. <dd>
  670. Return the cannonicalized absolute pathname.
  671. <h3>Parameters</h3>
  672. <ul>
  673. <li>
  674. path: Path
  675. </li>
  676. </ul>
  677. <h3>Return value:</h3>
  678. absolute path
  679. </dd>
  680. <dt><a name="nixio.fs.remove"></a><strong>remove</strong>&nbsp;(path)</dt>
  681. <dd>
  682. Remove a file or directory.
  683. <h3>Parameters</h3>
  684. <ul>
  685. <li>
  686. path: Path
  687. </li>
  688. </ul>
  689. <h3>Return value:</h3>
  690. true
  691. </dd>
  692. <dt><a name="nixio.fs.rename"></a><strong>rename</strong>&nbsp;(src, dest)</dt>
  693. <dd>
  694. Renames a file or directory.
  695. <h3>Parameters</h3>
  696. <ul>
  697. <li>
  698. src: Source path
  699. </li>
  700. <li>
  701. dest: Destination path
  702. </li>
  703. </ul>
  704. <h3>Usage:</h3>
  705. It is normally not possible to rename files across filesystems.
  706. <h3>Return value:</h3>
  707. true
  708. </dd>
  709. <dt><a name="nixio.fs.rmdir"></a><strong>rmdir</strong>&nbsp;(path)</dt>
  710. <dd>
  711. Remove an empty directory.
  712. <h3>Parameters</h3>
  713. <ul>
  714. <li>
  715. path: Path
  716. </li>
  717. </ul>
  718. <h3>Return value:</h3>
  719. true
  720. </dd>
  721. <dt><a name="nixio.fs.stat"></a><strong>stat</strong>&nbsp;(path, field)</dt>
  722. <dd>
  723. Get file status and attributes.
  724. <h3>Parameters</h3>
  725. <ul>
  726. <li>
  727. path: Path
  728. </li>
  729. <li>
  730. field: Only return a specific field, not the whole table (optional)
  731. </li>
  732. </ul>
  733. <h3>Return value:</h3>
  734. Table containing: <ul>
  735. <li>atime = Last access timestamp</li>
  736. <li>blksize = Blocksize (POSIX only)</li>
  737. <li>blocks = Blocks used (POSIX only)</li>
  738. <li>ctime = Creation timestamp</li>
  739. <li>dev = Device ID</li>
  740. <li>gid = Group ID</li>
  741. <li>ino = Inode</li>
  742. <li>modedec = Mode converted into a decimal number</li>
  743. <li>modestr = Mode as string as returned by <code>ls -l</code></li>
  744. <li>mtime = Last modification timestamp</li>
  745. <li>nlink = Number of links</li>
  746. <li>rdev = Device ID (if special file)</li>
  747. <li>size = Size in bytes</li>
  748. <li>type = ["reg", "dir", "chr", "blk", "fifo", "lnk", "sock"]</li>
  749. <li>uid = User ID</li>
  750. </ul>
  751. </dd>
  752. <dt><a name="nixio.fs.statvfs"></a><strong>statvfs</strong>&nbsp;(path)</dt>
  753. <dd>
  754. (POSIX) Get filesystem statistics.
  755. <h3>Parameters</h3>
  756. <ul>
  757. <li>
  758. path: Path to any file within the filesystem.
  759. </li>
  760. </ul>
  761. <h3>Return value:</h3>
  762. Table containing: <ul>
  763. <li>bavail = available blocks</li>
  764. <li>bfree = free blocks</li>
  765. <li>blocks = number of fragments</li>
  766. <li>frsize = fragment size</li>
  767. <li>favail = available inodes</li>
  768. <li>ffree = free inodes</li>
  769. <li>files = inodes</li>
  770. <li>flag = flags</li>
  771. <li>fsid = filesystem ID</li>
  772. <li>namemax = maximum filename length</li>
  773. </ul>
  774. </dd>
  775. <dt><a name="nixio.fs.symlink"></a><strong>symlink</strong>&nbsp;(oldpath, newpath)</dt>
  776. <dd>
  777. (POSIX) Create a symbolic link.
  778. <h3>Parameters</h3>
  779. <ul>
  780. <li>
  781. oldpath: Path
  782. </li>
  783. <li>
  784. newpath: Path
  785. </li>
  786. </ul>
  787. <h3>Return value:</h3>
  788. true
  789. </dd>
  790. <dt><a name="nixio.fs.unlink"></a><strong>unlink</strong>&nbsp;(path)</dt>
  791. <dd>
  792. Delete a name and - if no links are left - the associated file.
  793. <h3>Parameters</h3>
  794. <ul>
  795. <li>
  796. path: Path
  797. </li>
  798. </ul>
  799. <h3>Return value:</h3>
  800. true
  801. </dd>
  802. <dt><a name="nixio.fs.utimes"></a><strong>utimes</strong>&nbsp;(path, actime, mtime)</dt>
  803. <dd>
  804. Change file last access and last modification time.
  805. <h3>Parameters</h3>
  806. <ul>
  807. <li>
  808. path: Path
  809. </li>
  810. <li>
  811. actime: Last access timestamp (optional, default: current time)
  812. </li>
  813. <li>
  814. mtime: Last modification timestamp (optional, default: actime)
  815. </li>
  816. </ul>
  817. <h3>Return value:</h3>
  818. true
  819. </dd>
  820. <dt><a name="nixio.fs.writefile"></a><strong>writefile</strong>&nbsp;(path, data)</dt>
  821. <dd>
  822. Write a buffer into a file truncating the file first.
  823. <h3>Parameters</h3>
  824. <ul>
  825. <li>
  826. path: Path
  827. </li>
  828. <li>
  829. data: Data to write
  830. </li>
  831. </ul>
  832. <h3>Return value:</h3>
  833. true
  834. </dd>
  835. </dl>
  836. </div> <!-- id="content" -->
  837. </div> <!-- id="main" -->
  838. <div id="about">
  839. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
  840. </div> <!-- id="about" -->
  841. </div> <!-- id="container" -->
  842. </body>
  843. </html>