How to load blob data or original file content using ngx-doc viewer in angular 9? - angular9

Actually I want to load my blob data or original file content in ngx-doc-viewer,
I could not see any solutions here to load the blob or file content in ngx-doc-viewer
It requires file path
But Instead of using file path we need to load blob data or file original content
Below I mentioned the code
<ngx-doc-viewer #document_viewer [url]="fileURL" viewer="google" style="width:100%;height:93vh;">
</ngx-doc-viewer>
Instead of using [url]="fileURL". We want to load blob data
let BlobData = "blob text";

Related

How do I get my file to be saved as JSON after writing a JSON file into AWS S3 bucket

I am trying to write a JSON file into my AWS S3 bucket. However, I do not get a JSON file after it has been uploaded.
I get my data from a website using a request.get() and format it into a JSON file which I then run the following script to upload it to me S3 bucket.
r = requests.get(url=id_url, params=params)
data = r.json()
s3_client.put_object(
Body=json.dumps(data, indent=3),
Bucket='bucket-name',
Key=fileName
)
However, I am not sure what the type of file is but it is supposed to be saved as a JSON file.
Screenshot of my S3 bucket having no file type
Screenshot of my download folder, showing unable to identify the file type
When I open the file by selecting Pycharm, it is just a dictionary with key and values
Solved it, I simply added ".JSON" to the filename and it has solved the file formatting issue. Dont know why I didnt think of this earlier.
Thank you
Ideally you shouldn't rely of file extensions to specify the content type. The put_object method supports specifying ContentType. This means that you can use any file name you like, without needing to specify .json.
e.g.
s3_client.put_object(
Body=json.dumps(data, indent=3),
Bucket='bucket-name',
Key=fileName,
ContentType='application/json'
)

How to use external data file in Bokeh standalone HTML (no Bokeh server)

I want to use Bokeh on commodity webhosting, where no Bokeh server is available. Is there a way to create a Bokeh standalone html file, that can access an external data file (such as CSV or JSON) and use that data?
This way, a user can update the data file (for example upload a new CSV file), and the Bokeh data visualization wil use this updated data automatically.
Bokeh 1.3 added a new FileInput widget. However, it should be noted that a static HTML page can only update in response to an uploaded file while the page is open. There is no way to make any persistent changes based on the file upload (short of calling out to some remote REST API or database). Reloading the page would return it it whatever original state it was in before the upload.

Import csv with paths to pdf files

I have a custom content type (product) containing a title, some text and a file (a pdf file).
A lot of products have to be imported to the Drupal CMS. I discovered the plugin "Feeds" which seems to fulfill my requirements.
I managed to import a csv files containing a title and some text.
Now in my csv file I have a column containing a path to all the pdf files (like C:\mypdfs\product1.pdf). How can I manage that those pdf files are imported by Feeds? In "Mapping" configuration I'm not sure what target I have to select for those column which contains the path to a local file.
Using Feeds Tamper module you can manipulate the value of imported data for one target. Here you can build a custom tamper (See How) and use it to process the retrieved value (file path), using file_get_contents to get the file from imported path and file_save_data to save a file in Drupal, getting a field object that you can attach to an entity (this could help).

Box API large file upload results in corrupt file

I'm trying to upload a large file > 200 MB using new Box API.
Can I upload it in chunks?
Currently the box API does not support uploading a file in chunks. You may include a "Content-MD5" header with your request that contains the SHA1 hash of the file. Box will check this against the uploaded contents to ensure the file is not corrupted in transit.
See: http://developers.box.com/docs/#files-upload-a-file

box-api Download a File: how to save raw text response to file with correct encoding

I implemented downloading a file. I received raw string data. I save this data to a file, but can't open it, because file is invalid.
I tried to download jpg image.
I think this is a result of incorrect converting this data to bytes.
What Encoding I need to use?