Writing content from binary in server side javascript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2015 10:32 AM
Hi,
we have this kind of scenario. We got file data as binary from JSON and that binary should be converted to text and added as content to a document that is also created in the same web script. Now ScriptContent has following method "write" that takes another ScriptNode as a parameter, does the conversion automatically and writes it. If I use document.content.content = <my binary> it adds the binary as String without conversion. But I only have this raw binary data so I can't use write method either (it needs another ScriptContent). How could I write the content to a file? Or is there any method I could use to convert the binary to text and add as content? I should do the conversion in web service javascript where all the native javascript functionality is not available. A bit tough scenario.
Thanks in advance to anyone willing to help.
we have this kind of scenario. We got file data as binary from JSON and that binary should be converted to text and added as content to a document that is also created in the same web script. Now ScriptContent has following method "write" that takes another ScriptNode as a parameter, does the conversion automatically and writes it. If I use document.content.content = <my binary> it adds the binary as String without conversion. But I only have this raw binary data so I can't use write method either (it needs another ScriptContent). How could I write the content to a file? Or is there any method I could use to convert the binary to text and add as content? I should do the conversion in web service javascript where all the native javascript functionality is not available. A bit tough scenario.
Thanks in advance to anyone willing to help.
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2015 03:41 AM
Hi,
I guess I could convert the string to Base64 and add it as a content like this content.content = content. I know I could use btoa() to convert the string but I can't access the function from server side javascript. Is there any way I can access native functions from server side?
I guess I could convert the string to Base64 and add it as a content like this content.content = content. I know I could use btoa() to convert the string but I can't access the function from server side javascript. Is there any way I can access native functions from server side?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2015 05:53 AM
What do you mean by "raw binary data". That's meaningless, its data in some known format. And you want it in another format. What exactly.
Please reword your questions. You may understand what you are asking in your postings. Others probably can't follow.
Please reword your questions. You may understand what you are asking in your postings. Others probably can't follow.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2015 06:13 AM
Hey, thanks for the reply and sorry for not being clear in my explanation. So I got string from JSON that represents binary data. Now I should probably convert it to Base64 and write it to the content of the node. I'm afraid my explanation is still quite obscure. I just don't know how to explain it better. However, I quite already gave up on that idea to use javascript. Instead I'm now implementing Java-Backed Web Script and my plan is to do the conversion with Java. I'm not yet closing the topic if someone can tell me how to do this in JavaScript.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2015 06:33 AM
Hi,
I am using CMIS api to create folder in alfresco i.e.
newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
newFolderProps.put(PropertyIds.NAME, folderNAme);
createdFolder = reqdFolder.createFolder(newFolderProps);
Here I have one problem that I have to create 100 folders , but this method will create one folder at a time so in this scenerio it will call 100 times same function,
Is there any way to create 100 or more than 100 folder in a single call of alfresco where I can give whole structure to create folder .
So it will increase the performance and send less call to alfresco server.
Please send me reply
Am using alfresco 4.2.c community edition.
I am using CMIS api to create folder in alfresco i.e.
newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
newFolderProps.put(PropertyIds.NAME, folderNAme);
createdFolder = reqdFolder.createFolder(newFolderProps);
Here I have one problem that I have to create 100 folders , but this method will create one folder at a time so in this scenerio it will call 100 times same function,
Is there any way to create 100 or more than 100 folder in a single call of alfresco where I can give whole structure to create folder .
So it will increase the performance and send less call to alfresco server.
Please send me reply
Am using alfresco 4.2.c community edition.
