We can move a file to S3 like so
library(aws.s3)
saveRDS(iris, "iris.RDS")
put_object("iris.RDS", object="iris.RDS", bucket="mybucket", acl=c("public-read"))
Instead of moving the file to the root of the S3 bucket, how can I place it inside a folder in the S3 bucket?
What I've tried
I've tried the obvious solution, prepending the folder name to the object, but it errors
put_object("iris.RDS", object="myfolder/iris.RDS", bucket="mybucket", acl=c("public-read"))
Notes
I have already created a folder manually through the browser, so it's ready to go, I just need to know how to put files there
Related
I have a network request in the form of:
http://www.blahblah.com/folder/version/dist
I would like to add a rule to the Map Local option in Charles, in order to serve a directory that looks like:
Users/me/Documents/code/project/dist
The file structure of both dist folders are the same. My current request rule is: http://www.blahblah.com/folder/*/dist, and I'm asking it to serve Users/me/Documents/code/project/dist in its place, however, the files still come from the original requested resource.
Is there a way to proxy a whole directory?
You should be able to do so, by what is said in the CharlesProxy documentation:
If you are testing css, swf or image changes you can map those file types to your local development copy of the website so you can browse the live site with all your development assets. Create a mapping from live.com/*.css to the root of your local development copy, and similar mappings for the other file types. Alternatively you can map whole directories or individual files as required.
I guess your problem might be on the path where you are trying to map from. I would say you need to add an asterisk at the end of your path, something like:
http://www.blahblah.com/folder/*/dist/*
You can try to add the .css as done in the example
http://www.blahblah.com/folder/*/dist/*.css
In another SO post here, the second option is to write G.this; in the first "top" file in order to create a namespace.
And then write "use strict" on the top of every other js file.
Is that all the content of such a file? and if so, where the "top" file should be located (server, client, both) and what name? as Meteor loads files based on their paths. Thanks
One of ways to create a global namespace in Meteor (as suggested in the SO answer) is to have a file where a global alias to this is declared, such as:
G = this;
This file should, ideally, be loaded first and on both client and server.
To achieve this, according to the doc:
Files within lib/ directory are loaded first (after loading template files on client).
Meteor will load any file outside client/ or server/ directories on both client and server.
Where no other rules may apply, alphabetical ordering of the paths is used to determine load order of the files.
So, in keeping with these rules I would save the file as app.js (or any similar name that would come first alphabetically). Then I would place this file at the root of lib/ folder so that it gets loaded both on client and server.
So, the path to app.js would be : ./your_meteor_project_root/lib/app.js
In My Project, I have S3 bucket but i have to recursively acccess all the objects within that given bucket. It should be like recursively processing directory or file structure. When i tried to access the objects of the bucket, I'm getting AccessDeniedException.
s3 = AWS::S3.new
bucket = s3.buckets['bucket_name']
bucket.objects #raises Exception
I'm not sure if this is the correct way to do this, but I had a problem where I was not able to upload to anything other than the root folders with the other IAM accounts I created. After adding this change in the image below I was able to put objects in folders other than the root path.
In my case I had created the bucket with the root account, but had another user that was setup to add files to the bucket. The other user account was the one that had issues adding new items into the bucket.
Assume I want to write to a new file created within the space of my webapp.
One way would be use getServletContext().getRealPath("/") and use that String to create a new file on the server. However, often I come across advice like not using getServletContext().getRealPath("/").
Can someone please let me know of another way to write a new file within my webapp?
Many thanks.
Have some configuration property containing the absolute path of a directory outside of the webapp and web server path, read this path from the configuration property, and write to this directory.
To serve files from this directory, write a servlet that takes the name or ID of this file as parameter, reads the file from the directory, and sends its content to the response.
This will
work even if the app is deployed as a war file and never unzipped to the file system
allow you to redeploy the next version of the app or server without deleting all the uploaded/created files
allow you to add whatever control you want on the uploaded/created files, instead of making them available to everyone
In short, treat these files as data, stored in a database which happens to be the file system instead of a SQL database.
Salvete! When we set up the asp.net file-uploading control called "NeatUpload", it saves its files to a temporary location, either "YOUR_APP_ROOT /app_data/NeatUpload_Temp/", if the directory is writable, or to the system's temp folder. However, the demo does not seem to actually upload any files, nor does it include an example for saving the files to a particular directory.
How do we save the file we have uploaded and move the uploaded file to a particular folder? My only clue from the documentation is that it has to do with UploadStorageProvider, but I need some help to implement this.
if you read the documentation 3.3 point 6 :
In your codebehind file, process the uploaded file. If you are using
the InputFile control, the uploaded file's client-specified name, MIME
type, and contents can be accessed via inputFileId.FileName,
inputFileId.ContentType, and inputFileId .FileContent, respectively.
If you want to keep the uploaded file, you must use the
inputFileId.MoveTo()method to move the uploaded file to a permanent
location. If you do not, NeatUpload will automatically remove the
uploaded file at the end of the requestto ensure that unwanted files
do not fill up the filesystem. The following code will put the
uploaded file in the application's root directory (assuming sufficient
permissions):
and so on. I hope this is what you are after.