High-Performance Open-Source Archive
Alfr allows you to work with content directly within the Alfresco repository.
First include the alfr library.
In order to communicate with the Alfresco repository you must first establish a session connection. The location of the respository is required to do this, along with valid user credentials.
session <- alf_session("http://localhost:8080", "admin", "admin")
All content is stored on a repository node so before we can upload binary content we must first create a node to store it within. In this example we are creating a node called myFile2.txt in the folder test. -root- is used to reference the root repository node.
my_file <- alf_node.new(session, "-root-", list(name="myFile2.txt", nodeType="cm:content", relativePath="test"))
Now content can be uploaded into the nodes content property where it will be stored in the Alfresco repository.
my_file <- my_file$content$update("resources/testuploaddoc.txt")
Get a reference to the node you want to read content from.
my_file <- alf_node.new(session, "-root-", relativePath="test/myFile2.txt")
Content stored in a repository node can then be read to the client by opening a connection and reading the contents.
con <- my_file$content$as.file("resources/download.txt") %>% file("r")
readLines(con)
close(con)
With a reference to the node that you want to delete from the repository.
alf_node.delete(session, node$id)
Need mirroring services?
Contact our team at info@vpspulse.com.
Mirror powered by VPSpulse
Infrastructure sponsored by VPSPulse & Secure Payments by ArionPay.