documentation: regenerate documents from current code base
[project/luci.git] / documentation / api / modules / nixio.fs.html
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
10 <body>
11 <div id="container">
12
13 <div id="product">
14         <div id="product_logo"></div>
15         <div id="product_name"><big><b></b></big></div>
16         <div id="product_description"></div>
17 </div> <!-- id="product" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li>
38                 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39         </li>
40
41         <li>
42                 <a href="../modules/luci.http.html">luci.http</a>
43         </li>
44
45         <li>
46                 <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
47         </li>
48
49         <li>
50                 <a href="../modules/luci.http.date.html">luci.http.date</a>
51         </li>
52
53         <li>
54                 <a href="../modules/luci.http.mime.html">luci.http.mime</a>
55         </li>
56
57         <li>
58                 <a href="../modules/luci.i18n.html">luci.i18n</a>
59         </li>
60
61         <li>
62                 <a href="../modules/luci.ip.html">luci.ip</a>
63         </li>
64
65         <li>
66                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
67         </li>
68
69         <li>
70                 <a href="../modules/luci.json.html">luci.json</a>
71         </li>
72
73         <li>
74                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
75         </li>
76
77         <li>
78                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
79         </li>
80
81         <li>
82                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
83         </li>
84
85         <li>
86                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
87         </li>
88
89         <li>
90                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
91         </li>
92
93         <li>
94                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
95         </li>
96
97         <li>
98                 <a href="../modules/luci.sys.html">luci.sys</a>
99         </li>
100
101         <li>
102                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
103         </li>
104
105         <li>
106                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
107         </li>
108
109         <li>
110                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
111         </li>
112
113         <li>
114                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
115         </li>
116
117         <li>
118                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
119         </li>
120
121         <li>
122                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
123         </li>
124
125         <li>
126                 <a href="../modules/luci.util.html">luci.util</a>
127         </li>
128
129         <li>
130                 <a href="../modules/nixio.html">nixio</a>
131         </li>
132
133         <li>
134                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
135         </li>
136
137         <li>
138                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
139         </li>
140
141         <li>
142                 <a href="../modules/nixio.File.html">nixio.File</a>
143         </li>
144
145         <li>
146                 <a href="../modules/nixio.README.html">nixio.README</a>
147         </li>
148
149         <li>
150                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
151         </li>
152
153         <li>
154                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
155         </li>
156
157         <li>
158                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
159         </li>
160
161         <li>
162                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
163         </li>
164
165         <li>
166                 <a href="../modules/nixio.bin.html">nixio.bin</a>
167         </li>
168
169         <li>
170                 <a href="../modules/nixio.bit.html">nixio.bit</a>
171         </li>
172
173         <li>
174                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
175         </li>
176
177         <li><strong>nixio.fs</strong></li>
178         
179 </ul>
180
181
182
183 <!-- File list -->
184
185
186
187
188
189
190
191 </div><!-- id="navigation" -->
192
193 <div id="content">
194
195 <h1>Class <code>nixio.fs</code></h1>
196
197 <p>
198  Low-level and high-level filesystem manipulation library.</p>
199
200
201
202
203
204
205
206 <h2>Functions</h2>
207 <table class="function_list">
208
209         <tr>
210         <td class="name" nowrap><a href="#nixio.fs.access">access</a>&nbsp;(path, mode1, ...)</td>
211         <td class="summary">
212  Check user's permission on a file.</td>
213         </tr>
214
215         <tr>
216         <td class="name" nowrap><a href="#nixio.fs.basename">basename</a>&nbsp;(path)</td>
217         <td class="summary">
218  Strip the directory part from a path.</td>
219         </tr>
220
221         <tr>
222         <td class="name" nowrap><a href="#nixio.fs.chmod">chmod</a>&nbsp;(path, mode)</td>
223         <td class="summary">
224  Change the file mode.</td>
225         </tr>
226
227         <tr>
228         <td class="name" nowrap><a href="#nixio.fs.chown">chown</a>&nbsp;(path, user, group)</td>
229         <td class="summary">
230  (POSIX) Change owner and group of a file.</td>
231         </tr>
232
233         <tr>
234         <td class="name" nowrap><a href="#nixio.fs.copy">copy</a>&nbsp;(src, dest)</td>
235         <td class="summary">
236  Copy a file, directory or symlink non-recursively preserving file mode, 
237  timestamps, owner and group.</td>
238         </tr>
239
240         <tr>
241         <td class="name" nowrap><a href="#nixio.fs.copyr">copyr</a>&nbsp;(src, dest)</td>
242         <td class="summary">
243  Copy a file, directory or symlink recursively preserving file mode, 
244  timestamps, owner and group.</td>
245         </tr>
246
247         <tr>
248         <td class="name" nowrap><a href="#nixio.fs.datacopy">datacopy</a>&nbsp;(src, dest, limit)</td>
249         <td class="summary">
250  Copy data between files.</td>
251         </tr>
252
253         <tr>
254         <td class="name" nowrap><a href="#nixio.fs.dir">dir</a>&nbsp;(path)</td>
255         <td class="summary">
256  Iterate over the entries of a directory.</td>
257         </tr>
258
259         <tr>
260         <td class="name" nowrap><a href="#nixio.fs.dirname">dirname</a>&nbsp;(path)</td>
261         <td class="summary">
262  Strip the base from a path.</td>
263         </tr>
264
265         <tr>
266         <td class="name" nowrap><a href="#nixio.fs.glob">glob</a>&nbsp;(pattern)</td>
267         <td class="summary">
268  (POSIX) Find pathnames matching a pattern.</td>
269         </tr>
270
271         <tr>
272         <td class="name" nowrap><a href="#nixio.fs.lchown">lchown</a>&nbsp;(path, user, group)</td>
273         <td class="summary">
274  (POSIX) Change owner and group of a file and do not resolve 
275  if target is a symlink.</td>
276         </tr>
277
278         <tr>
279         <td class="name" nowrap><a href="#nixio.fs.link">link</a>&nbsp;(oldpath, newpath)</td>
280         <td class="summary">
281  Create a hard link.</td>
282         </tr>
283
284         <tr>
285         <td class="name" nowrap><a href="#nixio.fs.lstat">lstat</a>&nbsp;(path, field)</td>
286         <td class="summary">
287  Get file status and attributes and do not resolve if target is a symlink.</td>
288         </tr>
289
290         <tr>
291         <td class="name" nowrap><a href="#nixio.fs.mkdir">mkdir</a>&nbsp;(path, mode)</td>
292         <td class="summary">
293  Create a new directory.</td>
294         </tr>
295
296         <tr>
297         <td class="name" nowrap><a href="#nixio.fs.mkdirr">mkdirr</a>&nbsp;(dest, mode)</td>
298         <td class="summary">
299  Create a directory and all needed parent directories recursively.</td>
300         </tr>
301
302         <tr>
303         <td class="name" nowrap><a href="#nixio.fs.mkfifo">mkfifo</a>&nbsp;(path, mode)</td>
304         <td class="summary">
305  (POSIX) Create a FIFO (named pipe).</td>
306         </tr>
307
308         <tr>
309         <td class="name" nowrap><a href="#nixio.fs.move">move</a>&nbsp;(src, dest)</td>
310         <td class="summary">
311  Rename a file, directory or symlink non-recursively across filesystems.</td>
312         </tr>
313
314         <tr>
315         <td class="name" nowrap><a href="#nixio.fs.mover">mover</a>&nbsp;(src, dest)</td>
316         <td class="summary">
317  Rename a file, directory or symlink recursively across filesystems.</td>
318         </tr>
319
320         <tr>
321         <td class="name" nowrap><a href="#nixio.fs.readfile">readfile</a>&nbsp;(path, limit)</td>
322         <td class="summary">
323  Read the contents of a file into a buffer.</td>
324         </tr>
325
326         <tr>
327         <td class="name" nowrap><a href="#nixio.fs.readlink">readlink</a>&nbsp;(path)</td>
328         <td class="summary">
329  (POSIX) Read the target of a symbolic link.</td>
330         </tr>
331
332         <tr>
333         <td class="name" nowrap><a href="#nixio.fs.realpath">realpath</a>&nbsp;(path)</td>
334         <td class="summary">
335  Return the cannonicalized absolute pathname.</td>
336         </tr>
337
338         <tr>
339         <td class="name" nowrap><a href="#nixio.fs.remove">remove</a>&nbsp;(path)</td>
340         <td class="summary">
341  Remove a file or directory.</td>
342         </tr>
343
344         <tr>
345         <td class="name" nowrap><a href="#nixio.fs.rename">rename</a>&nbsp;(src, dest)</td>
346         <td class="summary">
347  Renames a file or directory.</td>
348         </tr>
349
350         <tr>
351         <td class="name" nowrap><a href="#nixio.fs.rmdir">rmdir</a>&nbsp;(path)</td>
352         <td class="summary">
353  Remove an empty directory.</td>
354         </tr>
355
356         <tr>
357         <td class="name" nowrap><a href="#nixio.fs.stat">stat</a>&nbsp;(path, field)</td>
358         <td class="summary">
359  Get file status and attributes.</td>
360         </tr>
361
362         <tr>
363         <td class="name" nowrap><a href="#nixio.fs.statvfs">statvfs</a>&nbsp;(path)</td>
364         <td class="summary">
365  (POSIX) Get filesystem statistics.</td>
366         </tr>
367
368         <tr>
369         <td class="name" nowrap><a href="#nixio.fs.symlink">symlink</a>&nbsp;(oldpath, newpath)</td>
370         <td class="summary">
371  (POSIX) Create a symbolic link.</td>
372         </tr>
373
374         <tr>
375         <td class="name" nowrap><a href="#nixio.fs.unlink">unlink</a>&nbsp;(path)</td>
376         <td class="summary">
377  Delete a name and - if no links are left - the associated file.</td>
378         </tr>
379
380         <tr>
381         <td class="name" nowrap><a href="#nixio.fs.utimes">utimes</a>&nbsp;(path, actime, mtime)</td>
382         <td class="summary">
383  Change file last access and last modification time.</td>
384         </tr>
385
386         <tr>
387         <td class="name" nowrap><a href="#nixio.fs.writefile">writefile</a>&nbsp;(path, data)</td>
388         <td class="summary">
389  Write a buffer into a file truncating the file first.</td>
390         </tr>
391
392 </table>
393
394
395
396
397
398
399 <br/>
400 <br/>
401
402
403 <h2><a name="functions"></a>Functions</h2>
404 <dl class="function">
405
406
407
408 <dt><a name="nixio.fs.access"></a><strong>access</strong>&nbsp;(path, mode1, ...)</dt>
409 <dd>
410
411  Check user's permission on a file.
412
413
414 <h3>Parameters</h3>
415 <ul>
416         
417         <li>
418           path: Path
419         </li>
420         
421         <li>
422           mode1: First Mode to check ["f", "r", "w", "x"]
423         </li>
424         
425         <li>
426           ...: More Modes to check      [-"-]
427         </li>
428         
429 </ul>
430
431
432
433
434
435
436 <h3>Return value:</h3>
437 true
438
439
440
441 </dd>
442
443
444
445
446 <dt><a name="nixio.fs.basename"></a><strong>basename</strong>&nbsp;(path)</dt>
447 <dd>
448
449  Strip the directory part from a path.
450
451
452 <h3>Parameters</h3>
453 <ul>
454         
455         <li>
456           path: Path
457         </li>
458         
459 </ul>
460
461
462
463
464 <h3>Usage:</h3>
465 This function cannot fail and will never return nil.
466
467
468
469 <h3>Return value:</h3>
470 basename
471
472
473
474 </dd>
475
476
477
478
479 <dt><a name="nixio.fs.chmod"></a><strong>chmod</strong>&nbsp;(path, mode)</dt>
480 <dd>
481
482  Change the file mode.
483
484
485 <h3>Parameters</h3>
486 <ul>
487         
488         <li>
489           path: Path
490         </li>
491         
492         <li>
493           mode: File mode        
494  [decimal mode number, "[-r][-w][-xsS][-r][-w][-xsS][-r][-w][-xtT]"]
495         </li>
496         
497 </ul>
498
499
500
501
502 <h3>Usage</h3>
503 <ul>
504         
505         <li>Windows only supports setting the write-protection through the 
506  "Writable to others" bit.
507         
508         <li><strong>Notice:</strong> The mode-flag for the functions 
509  open, mkdir, mkfifo are affected by the umask. 
510         
511 </ul>
512
513
514
515 <h3>Return value:</h3>
516 true
517
518
519
520 <h3>See also:</h3>
521 <ul>
522         
523         <li><a href="">
524                 umask
525         </a>
526         
527 </ul>
528
529 </dd>
530
531
532
533
534 <dt><a name="nixio.fs.chown"></a><strong>chown</strong>&nbsp;(path, user, group)</dt>
535 <dd>
536
537  (POSIX) Change owner and group of a file.
538
539
540 <h3>Parameters</h3>
541 <ul>
542         
543         <li>
544           path: Path
545         </li>
546         
547         <li>
548           user: User ID or Username             (optional)
549         </li>
550         
551         <li>
552           group: Group ID or Groupname  (optional)
553         </li>
554         
555 </ul>
556
557
558
559
560
561
562 <h3>Return value:</h3>
563 true
564
565
566
567 </dd>
568
569
570
571
572 <dt><a name="nixio.fs.copy"></a><strong>copy</strong>&nbsp;(src, dest)</dt>
573 <dd>
574
575  Copy a file, directory or symlink non-recursively preserving file mode, 
576  timestamps, owner and group.
577
578
579 <h3>Parameters</h3>
580 <ul>
581         
582         <li>
583           src: Source path
584         </li>
585         
586         <li>
587           dest: Destination path
588         </li>
589         
590 </ul>
591
592
593
594
595 <h3>Usage:</h3>
596 The destination must always be a full destination path e.g. do not 
597  omit the basename even if source and destination basename are equal. 
598
599
600
601 <h3>Return value:</h3>
602 true
603
604
605
606 </dd>
607
608
609
610
611 <dt><a name="nixio.fs.copyr"></a><strong>copyr</strong>&nbsp;(src, dest)</dt>
612 <dd>
613
614  Copy a file, directory or symlink recursively preserving file mode, 
615  timestamps, owner and group.
616
617
618 <h3>Parameters</h3>
619 <ul>
620         
621         <li>
622           src: Source path
623         </li>
624         
625         <li>
626           dest: Destination path
627         </li>
628         
629 </ul>
630
631
632
633
634 <h3>Usage:</h3>
635 The destination must always be a full destination path e.g. do not 
636  omit the basename even if source and destination basename are equal. 
637
638
639
640 <h3>Return value:</h3>
641 true
642
643
644
645 </dd>
646
647
648
649
650 <dt><a name="nixio.fs.datacopy"></a><strong>datacopy</strong>&nbsp;(src, dest, limit)</dt>
651 <dd>
652
653  Copy data between files.
654
655
656 <h3>Parameters</h3>
657 <ul>
658         
659         <li>
660           src: Source file path
661         </li>
662         
663         <li>
664           dest: Destination file path
665         </li>
666         
667         <li>
668           limit: Maximum bytes to copy (optional)
669         </li>
670         
671 </ul>
672
673
674
675
676
677
678 <h3>Return value:</h3>
679 true
680
681
682
683 </dd>
684
685
686
687
688 <dt><a name="nixio.fs.dir"></a><strong>dir</strong>&nbsp;(path)</dt>
689 <dd>
690
691  Iterate over the entries of a directory.
692
693
694 <h3>Parameters</h3>
695 <ul>
696         
697         <li>
698           path: Path
699         </li>
700         
701 </ul>
702
703
704
705
706 <h3>Usage:</h3>
707 The special entries "." and ".." are omitted.
708
709
710
711 <h3>Return value:</h3>
712 directory iterator returning one entry per call
713
714
715
716 </dd>
717
718
719
720
721 <dt><a name="nixio.fs.dirname"></a><strong>dirname</strong>&nbsp;(path)</dt>
722 <dd>
723
724  Strip the base from a path.
725
726
727 <h3>Parameters</h3>
728 <ul>
729         
730         <li>
731           path: Path
732         </li>
733         
734 </ul>
735
736
737
738
739 <h3>Usage:</h3>
740 This function cannot fail and will never return nil.
741
742
743
744 <h3>Return value:</h3>
745 dirname
746
747
748
749 </dd>
750
751
752
753
754 <dt><a name="nixio.fs.glob"></a><strong>glob</strong>&nbsp;(pattern)</dt>
755 <dd>
756
757  (POSIX) Find pathnames matching a pattern.
758
759
760 <h3>Parameters</h3>
761 <ul>
762         
763         <li>
764           pattern: Pattern
765         </li>
766         
767 </ul>
768
769
770
771
772
773
774 <h3>Return values:</h3>
775 <ol>
776         
777         <li>path iterator
778         
779         <li>number of matches
780         
781 </ol>
782
783
784
785 </dd>
786
787
788
789
790 <dt><a name="nixio.fs.lchown"></a><strong>lchown</strong>&nbsp;(path, user, group)</dt>
791 <dd>
792
793  (POSIX) Change owner and group of a file and do not resolve 
794  if target is a symlink.
795
796
797 <h3>Parameters</h3>
798 <ul>
799         
800         <li>
801           path: Path
802         </li>
803         
804         <li>
805           user: User ID or Username             (optional)
806         </li>
807         
808         <li>
809           group: Group ID or Groupname  (optional)
810         </li>
811         
812 </ul>
813
814
815
816
817
818
819 <h3>Return value:</h3>
820 true
821
822
823
824 </dd>
825
826
827
828
829 <dt><a name="nixio.fs.link"></a><strong>link</strong>&nbsp;(oldpath, newpath)</dt>
830 <dd>
831
832  Create a hard link.
833
834
835 <h3>Parameters</h3>
836 <ul>
837         
838         <li>
839           oldpath: Path
840         </li>
841         
842         <li>
843           newpath: Path
844         </li>
845         
846 </ul>
847
848
849
850
851 <h3>Usage:</h3>
852 This function calls link() on POSIX and CreateHardLink() on Windows.
853
854
855
856 <h3>Return value:</h3>
857 true
858
859
860
861 </dd>
862
863
864
865
866 <dt><a name="nixio.fs.lstat"></a><strong>lstat</strong>&nbsp;(path, field)</dt>
867 <dd>
868
869  Get file status and attributes and do not resolve if target is a symlink.
870
871
872 <h3>Parameters</h3>
873 <ul>
874         
875         <li>
876           path: Path
877         </li>
878         
879         <li>
880           field: Only return a specific field, not the whole table (optional)
881         </li>
882         
883 </ul>
884
885
886
887
888
889
890 <h3>Return value:</h3>
891 Table containing attributes (see stat for a detailed description)
892
893
894
895 <h3>See also:</h3>
896 <ul>
897         
898         <li><a href="#nixio.fs.stat">
899                 stat
900         </a>
901         
902 </ul>
903
904 </dd>
905
906
907
908
909 <dt><a name="nixio.fs.mkdir"></a><strong>mkdir</strong>&nbsp;(path, mode)</dt>
910 <dd>
911
912  Create a new directory.
913
914
915 <h3>Parameters</h3>
916 <ul>
917         
918         <li>
919           path: Path
920         </li>
921         
922         <li>
923           mode: File mode (optional, see chmod and umask)
924         </li>
925         
926 </ul>
927
928
929
930
931
932
933 <h3>Return value:</h3>
934 true
935
936
937
938 <h3>See also:</h3>
939 <ul>
940         
941         <li><a href="#nixio.fs.chmod">
942                 chmod
943         </a>
944         
945         <li><a href="">
946                 umask
947         </a>
948         
949 </ul>
950
951 </dd>
952
953
954
955
956 <dt><a name="nixio.fs.mkdirr"></a><strong>mkdirr</strong>&nbsp;(dest, mode)</dt>
957 <dd>
958
959  Create a directory and all needed parent directories recursively. 
960
961
962 <h3>Parameters</h3>
963 <ul>
964         
965         <li>
966           dest: Destination path
967         </li>
968         
969         <li>
970           mode: File mode (optional, see chmod and umask)
971         </li>
972         
973 </ul>
974
975
976
977
978
979
980 <h3>Return value:</h3>
981 true
982
983
984
985 <h3>See also:</h3>
986 <ul>
987         
988         <li><a href="#nixio.fs.chmod">
989                 chmod
990         </a>
991         
992         <li><a href="">
993                 umask
994         </a>
995         
996 </ul>
997
998 </dd>
999
1000
1001
1002
1003 <dt><a name="nixio.fs.mkfifo"></a><strong>mkfifo</strong>&nbsp;(path, mode)</dt>
1004 <dd>
1005
1006  (POSIX) Create a FIFO (named pipe).
1007
1008
1009 <h3>Parameters</h3>
1010 <ul>
1011         
1012         <li>
1013           path: Path
1014         </li>
1015         
1016         <li>
1017           mode: File mode (optional, see chmod and umask)
1018         </li>
1019         
1020 </ul>
1021
1022
1023
1024
1025
1026
1027 <h3>Return value:</h3>
1028 true
1029
1030
1031
1032 <h3>See also:</h3>
1033 <ul>
1034         
1035         <li><a href="#nixio.fs.chmod">
1036                 chmod
1037         </a>
1038         
1039         <li><a href="">
1040                 umask
1041         </a>
1042         
1043 </ul>
1044
1045 </dd>
1046
1047
1048
1049
1050 <dt><a name="nixio.fs.move"></a><strong>move</strong>&nbsp;(src, dest)</dt>
1051 <dd>
1052
1053  Rename a file, directory or symlink non-recursively across filesystems.
1054
1055
1056 <h3>Parameters</h3>
1057 <ul>
1058         
1059         <li>
1060           src: Source path
1061         </li>
1062         
1063         <li>
1064           dest: Destination path
1065         </li>
1066         
1067 </ul>
1068
1069
1070
1071
1072 <h3>Usage:</h3>
1073 The destination must always be a full destination path e.g. do not 
1074  omit the basename even if source and destination basename are equal. 
1075
1076
1077
1078 <h3>Return value:</h3>
1079 true
1080
1081
1082
1083 </dd>
1084
1085
1086
1087
1088 <dt><a name="nixio.fs.mover"></a><strong>mover</strong>&nbsp;(src, dest)</dt>
1089 <dd>
1090
1091  Rename a file, directory or symlink recursively across filesystems.
1092
1093
1094 <h3>Parameters</h3>
1095 <ul>
1096         
1097         <li>
1098           src: Source path
1099         </li>
1100         
1101         <li>
1102           dest: Destination path
1103         </li>
1104         
1105 </ul>
1106
1107
1108
1109
1110 <h3>Usage:</h3>
1111 The destination must always be a full destination path e.g. do not 
1112  omit the basename even if source and destination basename are equal. 
1113
1114
1115
1116 <h3>Return value:</h3>
1117 true
1118
1119
1120
1121 </dd>
1122
1123
1124
1125
1126 <dt><a name="nixio.fs.readfile"></a><strong>readfile</strong>&nbsp;(path, limit)</dt>
1127 <dd>
1128
1129  Read the contents of a file into a buffer.
1130
1131
1132 <h3>Parameters</h3>
1133 <ul>
1134         
1135         <li>
1136           path: Path
1137         </li>
1138         
1139         <li>
1140           limit: Maximum bytes to read (optional)
1141         </li>
1142         
1143 </ul>
1144
1145
1146
1147
1148
1149
1150 <h3>Return value:</h3>
1151 file contents
1152
1153
1154
1155 </dd>
1156
1157
1158
1159
1160 <dt><a name="nixio.fs.readlink"></a><strong>readlink</strong>&nbsp;(path)</dt>
1161 <dd>
1162
1163  (POSIX) Read the target of a symbolic link.
1164
1165
1166 <h3>Parameters</h3>
1167 <ul>
1168         
1169         <li>
1170           path: Path
1171         </li>
1172         
1173 </ul>
1174
1175
1176
1177
1178
1179
1180 <h3>Return value:</h3>
1181 target path
1182
1183
1184
1185 </dd>
1186
1187
1188
1189
1190 <dt><a name="nixio.fs.realpath"></a><strong>realpath</strong>&nbsp;(path)</dt>
1191 <dd>
1192
1193  Return the cannonicalized absolute pathname.
1194
1195
1196 <h3>Parameters</h3>
1197 <ul>
1198         
1199         <li>
1200           path: Path
1201         </li>
1202         
1203 </ul>
1204
1205
1206
1207
1208
1209
1210 <h3>Return value:</h3>
1211 absolute path
1212
1213
1214
1215 </dd>
1216
1217
1218
1219
1220 <dt><a name="nixio.fs.remove"></a><strong>remove</strong>&nbsp;(path)</dt>
1221 <dd>
1222
1223  Remove a file or directory.
1224
1225
1226 <h3>Parameters</h3>
1227 <ul>
1228         
1229         <li>
1230           path: Path
1231         </li>
1232         
1233 </ul>
1234
1235
1236
1237
1238
1239
1240 <h3>Return value:</h3>
1241 true
1242
1243
1244
1245 </dd>
1246
1247
1248
1249
1250 <dt><a name="nixio.fs.rename"></a><strong>rename</strong>&nbsp;(src, dest)</dt>
1251 <dd>
1252
1253  Renames a file or directory.
1254
1255
1256 <h3>Parameters</h3>
1257 <ul>
1258         
1259         <li>
1260           src: Source path
1261         </li>
1262         
1263         <li>
1264           dest: Destination path
1265         </li>
1266         
1267 </ul>
1268
1269
1270
1271
1272 <h3>Usage:</h3>
1273 It is normally not possible to rename files across filesystems.
1274
1275
1276
1277 <h3>Return value:</h3>
1278 true
1279
1280
1281
1282 </dd>
1283
1284
1285
1286
1287 <dt><a name="nixio.fs.rmdir"></a><strong>rmdir</strong>&nbsp;(path)</dt>
1288 <dd>
1289
1290  Remove an empty directory.
1291
1292
1293 <h3>Parameters</h3>
1294 <ul>
1295         
1296         <li>
1297           path: Path
1298         </li>
1299         
1300 </ul>
1301
1302
1303
1304
1305
1306
1307 <h3>Return value:</h3>
1308 true
1309
1310
1311
1312 </dd>
1313
1314
1315
1316
1317 <dt><a name="nixio.fs.stat"></a><strong>stat</strong>&nbsp;(path, field)</dt>
1318 <dd>
1319
1320  Get file status and attributes.
1321
1322
1323 <h3>Parameters</h3>
1324 <ul>
1325         
1326         <li>
1327           path: Path
1328         </li>
1329         
1330         <li>
1331           field: Only return a specific field, not the whole table (optional)
1332         </li>
1333         
1334 </ul>
1335
1336
1337
1338
1339
1340
1341 <h3>Return value:</h3>
1342 Table containing: <ul> 
1343  <li>atime = Last access timestamp</li> 
1344  <li>blksize = Blocksize (POSIX only)</li> 
1345  <li>blocks = Blocks used (POSIX only)</li> 
1346  <li>ctime = Creation timestamp</li> 
1347  <li>dev = Device ID</li> 
1348  <li>gid = Group ID</li> 
1349  <li>ino = Inode</li> 
1350  <li>modedec = Mode converted into a decimal number</li> 
1351  <li>modestr = Mode as string as returned by <code>ls -l</code></li> 
1352  <li>mtime = Last modification timestamp</li> 
1353  <li>nlink = Number of links</li> 
1354  <li>rdev = Device ID (if special file)</li> 
1355  <li>size = Size in bytes</li> 
1356  <li>type = ["reg", "dir", "chr", "blk", "fifo", "lnk", "sock"]</li> 
1357  <li>uid = User ID</li> 
1358  </ul>
1359
1360
1361
1362 </dd>
1363
1364
1365
1366
1367 <dt><a name="nixio.fs.statvfs"></a><strong>statvfs</strong>&nbsp;(path)</dt>
1368 <dd>
1369
1370  (POSIX) Get filesystem statistics.
1371
1372
1373 <h3>Parameters</h3>
1374 <ul>
1375         
1376         <li>
1377           path: Path to any file within the filesystem.
1378         </li>
1379         
1380 </ul>
1381
1382
1383
1384
1385
1386
1387 <h3>Return value:</h3>
1388 Table containing: <ul> 
1389  <li>bavail = available blocks</li> 
1390  <li>bfree = free blocks</li> 
1391  <li>blocks = number of fragments</li> 
1392  <li>frsize = fragment size</li> 
1393  <li>favail = available inodes</li> 
1394  <li>ffree = free inodes</li> 
1395  <li>files = inodes</li> 
1396  <li>flag = flags</li> 
1397  <li>fsid = filesystem ID</li> 
1398  <li>namemax = maximum filename length</li> 
1399  </ul>
1400
1401
1402
1403 </dd>
1404
1405
1406
1407
1408 <dt><a name="nixio.fs.symlink"></a><strong>symlink</strong>&nbsp;(oldpath, newpath)</dt>
1409 <dd>
1410
1411  (POSIX) Create a symbolic link.
1412
1413
1414 <h3>Parameters</h3>
1415 <ul>
1416         
1417         <li>
1418           oldpath: Path
1419         </li>
1420         
1421         <li>
1422           newpath: Path
1423         </li>
1424         
1425 </ul>
1426
1427
1428
1429
1430
1431
1432 <h3>Return value:</h3>
1433 true
1434
1435
1436
1437 </dd>
1438
1439
1440
1441
1442 <dt><a name="nixio.fs.unlink"></a><strong>unlink</strong>&nbsp;(path)</dt>
1443 <dd>
1444
1445  Delete a name and - if no links are left - the associated file.
1446
1447
1448 <h3>Parameters</h3>
1449 <ul>
1450         
1451         <li>
1452           path: Path
1453         </li>
1454         
1455 </ul>
1456
1457
1458
1459
1460
1461
1462 <h3>Return value:</h3>
1463 true
1464
1465
1466
1467 </dd>
1468
1469
1470
1471
1472 <dt><a name="nixio.fs.utimes"></a><strong>utimes</strong>&nbsp;(path, actime, mtime)</dt>
1473 <dd>
1474
1475  Change file last access and last modification time.
1476
1477
1478 <h3>Parameters</h3>
1479 <ul>
1480         
1481         <li>
1482           path: Path
1483         </li>
1484         
1485         <li>
1486           actime: Last access timestamp (optional, default: current time)
1487         </li>
1488         
1489         <li>
1490           mtime: Last modification timestamp (optional, default: actime)
1491         </li>
1492         
1493 </ul>
1494
1495
1496
1497
1498
1499
1500 <h3>Return value:</h3>
1501 true
1502
1503
1504
1505 </dd>
1506
1507
1508
1509
1510 <dt><a name="nixio.fs.writefile"></a><strong>writefile</strong>&nbsp;(path, data)</dt>
1511 <dd>
1512
1513  Write a buffer into a file truncating the file first.
1514
1515
1516 <h3>Parameters</h3>
1517 <ul>
1518         
1519         <li>
1520           path: Path
1521         </li>
1522         
1523         <li>
1524           data: Data to write
1525         </li>
1526         
1527 </ul>
1528
1529
1530
1531
1532
1533
1534 <h3>Return value:</h3>
1535 true
1536
1537
1538
1539 </dd>
1540
1541
1542 </dl>
1543
1544
1545
1546
1547
1548 </div> <!-- id="content" -->
1549
1550 </div> <!-- id="main" -->
1551
1552 <div id="about">
1553         <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>
1554 </div> <!-- id="about" -->
1555
1556 </div> <!-- id="container" -->
1557 </body>
1558 </html>