Closed jsloyer closed 8 years ago
@jabrena I would love to get your thoughts on this PR?
Also travis seems to be failing on pivotal...
Good night @jsloyer, sorry by the delay.
I am not sure if the idea to create the zip on fly is the responsibility of this kind of library. Another approach interesting could be to pass a Zip stream but not create the zip by the library.
I was checking the dependency: https://github.com/cthackers/adm-zip
In the last 2 years, the code was not evolved. If you observe the library, the number of dependencies is minimum. Why did you choose that library? Do you know other alternatives?
An interesting stuff could be the development of some library which download the content from a Git repo and later, pass a Zip Stream to the library. In some moment, I would like to upload the zip using Request. In the past, I couldn't and the library uses Restler, but I would like to unify all operations with Request a library with a healthy community.
What is your opinion?
Juan Antonio
In relation to this feature, did you see what is the behaviour of the CloudFoundry with DockerImages? The cloud controller download a complete image and later the CC install in the instance. In the past I try to discuss the same behaviour with the REST method: http://apidocs.cloudfoundry.org/228/apps/uploads_the_bits_for_an_app.html
It could be pretty interesting for the middleware but for this library, I think that it is better if another utility offer this idea.
@jabrena I have rewrote things to use streams. There are two options for integrating it. Making cf-nodejs-client responsible for zipping the app or allowing streams to be passed in. Which would you prefer? I would be tempted to include it here as the cf cli zips a folder.
I think that it is better to pass a Stream. So my next question is:
What is the availables libraries to pass streams? What is the alternatives in Stream terms?
You used in your example: adm-zip but in terms of Stream, does exist more alternatives?
If you like, we could accept other requests and work in this feature.
In relation to help the project with more resources, what is your idea from Bluemix perspective?
Juan Antonio
@jabrena it actually doesn't matter the stream of Stream you pass, all streams in node implement the core Streams api. My thought is to pass in a stream and then call toBuffer()
on it. All streams implement this toBuffer()
method.
Ill open up a PR with what I am thinking.
Oki
Closing in favor of #176
The CF cli creates a zip file on the fly when you push an app, this PR adds the same functionality, it creates a zip file on the file if a folder is passed to the upload function. The zip file is created in memory and then passed as a buffer in memory to restler for the upload.
resolves #169