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