开发者

Writing String into a File

开发者 https://www.devze.com 2022-12-31 21:06 出处:网络
I\'m implementing a WebScript using Alfresco\'s JavaScript. l\'m trying to insert string to a file, but I can\'t do it.

I'm implementing a WebScript using Alfresco's JavaScript. l'm trying to insert string to a file, but I can't do it.

When I write another file's content like:

file.properties.content.write(content);

It works, and the file's contents are copied into my file. But I can't insert string directly, like:

file.properties.conten开发者_StackOverflow中文版t.write("Stuff like that");

it gives an exception. How can I write string into this file?


Well, I got it, thanks to a guy from Alfresco forums. We need to set it versionable, then assigning the content writes into the file. It goes like:

var doc = userhome.createFile("checkmeout.txt");
doc.addAspect("cm:versionable");
doc.content = "original text";
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号