Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

File copying and getting file contents

$
0
0

So I am trying to get the file contents and send them via socket.write().

I am not entirely sure, if I'm doing this right, but  I was trying this:


var file = new File( "D:\\test.png" );
var file2 = new File( "D:\\test2.png" );

file.open("r");
file2.open("w");
file2.encoding = file.encoding;


do {
    file2.write(file.readch());
}
while ( !file.eof )

 

test.png exists and test2.png is created from scratch. And the files were not identical in the end. Which means, that getting the file contents with file.readch() or file.read() isn't the right solution. Right?

 

So, how do I get the file contents in some format, that can be send, and then, probably, rebuilt at the other end?


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>