My setup is the following: I have 1 storage account with a container and I have another storage account with a different container. What I want to do is have a blob trigger activate whenever someone uploads a file to the first storage account, and have that blob be copied to the second storage account's container. azcopy works well with the command line, but I have not found a way to use it within an azure function. Any help is appreciated, thanks.
For NodeJS, you would just use Child Processes (or a wrapper like execa) to run executables but isn't something I would recommend you do. Also, when running on Azure, you will have to make sure azcopy is present and if you still need to go down this path, Custom Containers would be your best bet.
In the case of Azure Functions if the file just must be copied to a different container, you could just use the Blob Output Binding which would achieve this with almost no code.
For more complex scenarios where the output binding lacks, you could just use the Blob Storage NodeJS SDK directly in your code.
Related
Hi onto my react app I need to see a document but I cannot upload it manually. I'll explain, the user if need, could upload a document and into another part of the app could see it.
I want to know if there's a possibility to organize something like
See document
So the user onClick can see the doc opened in another tab. I do some logic but I upload the document on my store after he can see it in the review mode.
So can I visualize it without charging it on localStorage or sessionStorage, should I use an external library?
It depends on the format of the document. if it's an image you can show it by encoding it to base64 for other types of documents I'm afraid you have to have it stored at some URL.
You don't need to upload it anywhere to open it, after the 'upload' (using the file chooser) you can store it in a variable and use it as you please (keep in mind that this is not always a good approach). However if you want to visualize\open it in the application, it depends on the file format and you might need to use an external library to interpret and present it
edit: add note in parenthesis
I'm listening to a Ctrl-C event and creating a JSON, I'll need this JSON in a different part of my application where I intend to use the JSON for a custom paste on Ctrl-V; but I don't have any reference here to the previous part, where the copy was done. Not even a global variable (long story).
Basically, these Ctrl-C and Ctrl-V events are supposed to copy and paste complex custom-made HTML elements, with their own events and keyframe animations, from one part of the application to the other. Working with the JSON is the only way to go.
I did some digging and came across questions like this, but they only address the case of putting selected text on the clipboard. I'm looking for something which can put custom content on the clipboard of the system or the browser.
Is there any inbuilt method, or an external utility or plugin, that would help me achieve this?
Thanks.
EDIT: This copy-paste feature will be used on a website by users, not just developers. Therefore, we can't assume anything. Cookies won't work because cookies might be turned off. localstorage or sessionstorage won't work because the application may be open for different projects in different windows; and the user might want to copy from one window and paste into another.
You could look in to cookies here using jQuery:
// You can seriaize the data as JSON, like this:
$.cookie("property-name", JSON.stringify($("#foo").data()));
// Get data from the cookie:
$("#foo").data(JSON.parse($.cookie("property-name")));
you could always use localstorage or sessionstorage depending on the lifetime required. although this may not work in older browsers. and will mean the user cannot paste in content from external sources
I am trying to create a program using HTML, which will be compiled for android. How can I create save game data for the app? I need to save thing such as health, money, etc. Would there be a way to do this with an INI file? I will be converting the entire html folder, including .js and .css into one apk, as well as a windows .exe. Is there a way for either or both of these systems to parse an ini file. Note: I am having some trouble with javascript, so a function that could be called like the following would be great:
saveINI(filename, section, key, value)
jQuery is fine too, as long as the function is simple to call.
Note: It doesnt matter where the ini file is saveable as long as the user would be okay with it
Update: I need a way that the user won't accidentally delete the save data accidentally
Unless you need to access this data from another application, you can use Web Storage. This is a native feature of javascript so you don't need external libraries. You just reference the localStorage object (persists data between sessions) or the sessionStorage (persists data just for a session) and store/retrieve items from it like:
Storage.getItem(key);
Storage.setItem(key, value);
INI really isn't your best choice here. There are a few problems with it, one of the more obvious ones is that they're easily editable and can be rife for cheating.
You're best off investigating an SQL database, something like SQLite - which will easily store key/value pairs like money = 550. There are implementations everywhere which should help, and it works on Windows and Android (amongst others).
You (probably) however can't work with it directly from HTML/JS.
Here's a good tutorial on Android SQLite:
http://www.vogella.com/tutorials/AndroidSQLite/article.html
If you're using PhoneGap, you could try this:
https://build.phonegap.com/plugins/731
I'm thinking of doing some online file manipulation for mobile users, the idea being that the user provides a URL to the file, then the file contents are modified by the JS, and can then be downloaded. But I haven't been able to figure out how to get the file when it's on a separate domain using just JS.
Is this possible? If so any hints or examples would be appreciated.
Just wanted to add that part of what I wanted to do was make it available without my hosting it. I'm thinking of something like a a file they can host somewhere,and then all of the bandwidth is their own...and that of wherever they are getting the file from of course.
The only way to load contents of a file on another domain is from within a <script> tag. This is how JSONP works. Look into getting your target file into this format.
The other way would be to use a local proxy. Create a web service method that loads and returns the contents of the file, then call that locally using your favorite JavaScript framework.
Depending on how you think of public webservices, and within some limitations I'm still mapping, you can do this using an ajax call to YQL, like so.
(will expand the answer later).
http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20data.uri%20where%20url=%22http://t3.gstatic.com/images?q=tbn:ANd9GcSyART8OudfFJQ5oBplmhZ6HIIlougzPgwQ9qcgknK8_tivdW0EOg%22
One of the limitations of this method is file size, it currently tops out at 25k.
Is there a way to create a file outside of the sandbox? Maybe something that works by first storing the file inside the sandbox and then letting the user drag a link to the locally stored file into a regular folder?
It is for a webchat: I want the user to be able to receive files, but I can't figure out a way that ensures that he can choose the target location that doesn't need a right-click->save as. If there is a better solution than using the filesystem API, feel free to suggest that, too.
How about an "a" element with a download attribute, and using FileEntry.toURL() to populate the href target?
Use a signed java applet to get root access to the system