Interfaces/NTFS File Streams

From J Wiki
Jump to: navigation, search

File streams in the NTFS file system allow more that one sequence of data to be associated with a file. For example Microsoft uses them to store the extended Properties as seen in the last tab of file properties in Explorer.

J can read and write file streams:

   load'files'
   'test'fwrite jpath'~temp/test.txt'
4
   'abc'fwrite jpath'~temp/test.txt:a'
3
   '123'fwrite jpath'~temp/test.txt:b'
3
   fread jpath'~temp/test.txt'
test
   fread jpath'~temp/test.txt:a'
abc
   fread jpath'~temp/test.txt:b'
123
   load'dir'
   dir jpath'~temp'
jbreak     <dir>     01-May-08 07:37:16
1.ijx            583 28-Apr-08 02:10:38
fif.htm         3821 30-Apr-08 01:55:58
test.txt           4 01-May-08 07:38:03

Note that there is only one file test.txt listed.

The streams verb from the Streams script can list streams available for a file.

Wiki page contributed by Ric Sherlock based on forum thread started by Oleg Kobchenko.