» Let me present to you: File IO
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Let me present to you: File IO

previously on VL: vl-progress-report-3


Dave Skylark said
same same, but different

on the way to catch up with what you know and need from vvvv, the first choice for expanding VL core library was to work on file thingies. The following should look extremely familiar and probably quite unexciting for you:

FileReader and FileWriter
the very basics needs

These guys do exactly what you would expect them to do: read from file, respectively write to a file. as a convenience nodes you have string versions, the standard ones give you bytes.


since it's 2016, these nodes do their work asyncronously, hence these output pins, which keep you informed about the working status, giving you the opportunity to draw some nice loading animation.

async loading info
async working status info

it wouldn't quite feel like vvvv if the curious ones could not actually peek inside the node to see what's going on

inside the FileReader
the guts of the FileReader

looks a bit overdone for such a simple thing, right?
the motive for the splitting up into File and the actual IO operation has a couple of (imho) good reasons:

chaining operations
chaining io operations

no need anymore to load the whole file and then decide what to do with the content. you can for example parse the header of a video file, look up some frame offset and directly do a partial read of just the blob you are interested

control over file access

there are a bunch of ways to access files. now you can actually control all of that. one reason might be security, since you can decide, whether anyone else can read or write or even delete the file at the same time. you can set it to forcibly create a new file, so you don't accidentally overwrite something existing.
another reason is performance, you are welcome to dive into the deeps of the web to find out which combination of modes causes which thread to do the work. we tried to set the defaults for best performance for parallel reading.

stream stream stream
Stream Operations
the ops: left blocking, right async; also available for strings

the File node actually returns the FileStream. so all these operations can instantly be used with anything else, that is a stream (which is a lot of things in the .net world)


while the async details here are still hidden away in the c# code of the nodes, the process has paved the way towards general patching of threading/async computation. stay tuned...
woei, Thursday, Dec 1st 2016 Digg | Tweet | Delicious 1 comments  
readme 02/12/2016 - 11:02

Reading this to the very end (2 lines) is most rewarding.

  • 1

anonymous user login

Shoutbox

~2d ago

joreg: vvvvTv S02E01 is out: Buttons & Sliders with Dear ImGui: https://www.youtube.com/live/PuuTilbqd9w

~9d ago

joreg: vvvvTv S02E00 is out: Sensors & Servos with Arduino: https://visualprogramming.net/blog/2024/vvvvtv-is-back-with-season-2/

~10d ago

fleg: hey there! What's the best tool for remote work? Teamviewer feels terrible. Thanks!

~23d ago

joreg: Last call: 6-session vvvv beginner course starting November 4: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-i/

~1mth ago

joreg: Missed the last meetup? You can rewatch it here: https://www.youtube.com/live/MdvTa58uxB0?si=Fwi-9hHoCmo794Ag

~1mth ago

theurbankind: When is the next big event, like node festival ?

~1mth ago

~1mth ago

joreg: Join us for the next vvvv meetup on Oktober 17th: https://visualprogramming.net/blog/2024/25.-vvvv-worldwide-meetup/

~2mth ago

joreg: 6 session beginner course part 2 "Deep Dive" starts January 13th: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-ii/