morphe2011 Member Licensed User Longtime User Jul 13, 2015 #1 Hello All A client has produced a wonderful api which works great . Most of the api is standard stuff that Job.GetString can handle. However at one point the stream is a zipped file . How do I get it and and save it as a zip so that I can open it and use it's contents? Most Thanks for any help.
Hello All A client has produced a wonderful api which works great . Most of the api is standard stuff that Job.GetString can handle. However at one point the stream is a zipped file . How do I get it and and save it as a zip so that I can open it and use it's contents? Most Thanks for any help.
walterf25 Expert Licensed User Longtime User Jul 13, 2015 #2 morphe2011 said: Hello All A client has produced a wonderful api which works great . Most of the api is standard stuff that Job.GetString can handle. However at one point the stream is a zipped file . How do I get it and and save it as a zip so that I can open it and use it's contents? Most Thanks for any help. Click to expand... There is a library to read and write zip files, can't remember the name of it now, but do a search and you should be able to find it. Cheers, Walter Upvote 0
morphe2011 said: Hello All A client has produced a wonderful api which works great . Most of the api is standard stuff that Job.GetString can handle. However at one point the stream is a zipped file . How do I get it and and save it as a zip so that I can open it and use it's contents? Most Thanks for any help. Click to expand... There is a library to read and write zip files, can't remember the name of it now, but do a search and you should be able to find it. Cheers, Walter
morphe2011 Member Licensed User Longtime User Jul 13, 2015 #3 Walter Thank you for the reply. I use the MLfiles library for reading and writing and it works great. My issue is in saving the file as it comes in as a file rather than a string. Normally I use FTP to download files but this data is very sensitive so that is not an option. Writing as a string produces an invalid zip and yes I'm already testing for Job.Success This is a sample of code: Sub JobDone (Job As HttpJob) Dim sResults As String If Job.JobName="hBook" Then sResults=Job.GetString iBo=Job.GetInputStream File.WriteString(ed.sAppPath,"test.zip",sResults) Return End If End sub Richard Upvote 0
Walter Thank you for the reply. I use the MLfiles library for reading and writing and it works great. My issue is in saving the file as it comes in as a file rather than a string. Normally I use FTP to download files but this data is very sensitive so that is not an option. Writing as a string produces an invalid zip and yes I'm already testing for Job.Success This is a sample of code: Sub JobDone (Job As HttpJob) Dim sResults As String If Job.JobName="hBook" Then sResults=Job.GetString iBo=Job.GetInputStream File.WriteString(ed.sAppPath,"test.zip",sResults) Return End If End sub Richard
morphe2011 Member Licensed User Longtime User Jul 13, 2015 #5 Manfred Thank you for the link. I've looked at it before and it is a great library however I'm either brain farting or it's the first signs of dementia (probably the latter) . B4a is and has been great. I can figure out 98% on my own but on this one I'm drawing a blank. If it was ASP.net or VB.net I'd know how to proceed. Please see my reply to Walter. Any help or direction would be most appreciated. Upvote 0
Manfred Thank you for the link. I've looked at it before and it is a great library however I'm either brain farting or it's the first signs of dementia (probably the latter) . B4a is and has been great. I can figure out 98% on my own but on this one I'm drawing a blank. If it was ASP.net or VB.net I'd know how to proceed. Please see my reply to Walter. Any help or direction would be most appreciated.
DonManfred Expert Licensed User Longtime User Jul 13, 2015 #6 morphe2011 said: Please see my reply to Walter. Any help or direction would be most appreciated. Click to expand... In your JobDone inside job.success Use Code: Copy OutStream = File.OpenOutput(ed.sAppPath, "test.zip", False) File. Copy2(Job.GetInputStream,OutStream) ' save the file OutStream.Close to save the job-result to a file Upvote 0
morphe2011 said: Please see my reply to Walter. Any help or direction would be most appreciated. Click to expand... In your JobDone inside job.success Use Code: Copy OutStream = File.OpenOutput(ed.sAppPath, "test.zip", False) File. Copy2(Job.GetInputStream,OutStream) ' save the file OutStream.Close to save the job-result to a file
morphe2011 Member Licensed User Longtime User Jul 13, 2015 #7 Yep a brain fart. Most thanks. Upvote 0