Tabnine Logo For Javascript
File._name
Code IndexAdd Tabnine to your IDE (free)

How to use
_name
function
in
File

Best JavaScript code snippets using parse.File._name(Showing top 3 results out of 315)

origin: parse-community/parse-server

it('beforeSaveFile should return file that is already saved and not save anything to files adapter', async () => {
  await reconfigureServer({ filesAdapter: mockAdapter });
  const createFileSpy = spyOn(mockAdapter, 'createFile').and.callThrough();
  Parse.Cloud.beforeSaveFile(() => {
   const newFile = new Parse.File('some-file.txt');
   newFile._url = 'http://www.somewhere.com/parse/files/some-app-id/some-file.txt';
   return newFile;
  });
  const file = new Parse.File('popeye.txt', [1, 2, 3], 'text/plain');
  const result = await file.save({ useMasterKey: true });
  expect(result).toBe(file);
  expect(result._name).toBe('some-file.txt');
  expect(result._url).toBe('http://www.somewhere.com/parse/files/some-app-id/some-file.txt');
  expect(createFileSpy).not.toHaveBeenCalled();
 });
origin: parse-community/parse-server

it('afterSaveFile should set fileSize to null if beforeSave returns an already saved file', async () => {
  await reconfigureServer({ filesAdapter: mockAdapter });
  const createFileSpy = spyOn(mockAdapter, 'createFile').and.callThrough();
  Parse.Cloud.beforeSaveFile((req) => {
   expect(req.fileSize).toBe(3);
   const newFile = new Parse.File('some-file.txt');
   newFile._url = 'http://www.somewhere.com/parse/files/some-app-id/some-file.txt';
   return newFile;
  });
  Parse.Cloud.afterSaveFile((req) => {
   expect(req.fileSize).toBe(null);
  });
  const file = new Parse.File('popeye.txt', [1, 2, 3], 'text/plain');
  const result = await file.save({ useMasterKey: true });
  expect(result).toBe(result);
  expect(result._name).toBe('some-file.txt');
  expect(result._url).toBe('http://www.somewhere.com/parse/files/some-app-id/some-file.txt');
  expect(createFileSpy).not.toHaveBeenCalled();
 });
origin: parse-community/parse-server

it('beforeSaveFile should change values by returning new fileObject', async () => {
  await reconfigureServer({ filesAdapter: mockAdapter });
  const createFileSpy = spyOn(mockAdapter, 'createFile').and.callThrough();
  Parse.Cloud.beforeSaveFile(async (req) => {
   expect(req.triggerName).toEqual('beforeSaveFile');
   expect(req.fileSize).toBe(3);
   const newFile = new Parse.File('donald_duck.pdf', [4, 5, 6], 'application/pdf');
   newFile.setMetadata({ foo: 'bar' });
   newFile.setTags({ tagA: 'some-tag' });
   return newFile;
  });
  const file = new Parse.File('popeye.txt', [1, 2, 3], 'text/plain');
  const result = await file.save({ useMasterKey: true });
  expect(result).toBeInstanceOf(Parse.File);
  const newData = new Buffer([4, 5, 6]);
  const newContentType = 'application/pdf';
  const newOptions = {
   tags: {
    tagA: 'some-tag',
   },
   metadata: {
    foo: 'bar',
   },
  };
  expect(createFileSpy).toHaveBeenCalledWith(jasmine.any(String), newData, newContentType, newOptions);
  const expectedFileName = 'donald_duck.pdf';
  expect(file._name.indexOf(expectedFileName)).toBe(file._name.length - expectedFileName.length);
 });
parse(npm)File_name

Most used parse functions

  • Cloud
  • Config
  • User
  • ACL
  • ACL.ACL
  • ACL.setPublicReadAccess,
  • ACL.setPublicWriteAccess,
  • ACL.setReadAccess,
  • ACL.setRoleReadAccess,
  • ACL.setRoleWriteAccess,
  • ACL.setWriteAccess,
  • Analytics,
  • Error,
  • FacebookUtils,
  • File,
  • File.File,
  • File._name,
  • File._url,
  • File.addMetadata

Popular in JavaScript

  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • fs
  • ms
    Tiny millisecond conversion utility
  • aws-sdk
    AWS SDK for JavaScript
  • crypto
  • request
    Simplified HTTP request client.
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • rimraf
    A deep deletion module for node (like `rm -rf`)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now