Wednesday, April 6, 2011

Decompressing a compressed stream to a network location

If I write a windows service, and it will write files from the local machine to the network, by compressing the bytes, then decompressing to a filestream representing the network drive, would this work?

For example, I compress a local file. I setup a filestream object which encapsulates a network path (e.g. a network drive might be N:/, so the path is N:/..../...), and then I decompress the bytes to that file location.

From stackoverflow
  • Yes, it will work, but it won't save you anything - you will load the uncompressed data from the local machine, compress it in memory, decompress it in memory, and write the uncompressed data to the network location. You might as well just copy the files.

    You will need the service to run as a user that has the network drive mapped. Note that the default LocalSystem user for services has no network drives mapped.

    dotnetdev : So I will need to impersonate the logged on user of the machine? Assuming he has network drives mapped to the right location (ie N:/). When you say doesn't save me anything, I assume you mean time, not the data.
    Sunlight : Yes, you will need to run as the user. You won't save either time or data. You read decompressed data, you write decompressed data. You're not going to send the compressed data over the network, because the decompression occurs within your program.

0 comments:

Post a Comment